attempting to load data via a bulk insert
declare @file varchar(1000)
declare @loadTableName varchar(1000)
declare @bulkLoad varchar(1000)
-- read contents of file into the respected table
--preset variable @loadTableName looks like: tlbCars
--preset variable @file looks like: C:\localProjects\stest\cars.txt
set @bulkLoad = 'bulk insert ' + @loadTableName + ' from "' + @file + '" with (fieldterminator = '|', rowterminator = ''' + char(10) + ''')'
exec(@bulkLoad)
the data in the cars.txt file looks like:
1|toyota|tacoma
1|toyota|tundra
1|toyota|fjcruiser
etc...
Error:
The data types varchar and varchar are incompatible in the '|' operator.