Why is that the following code doesn't work ..(error is Unknown argument '.csv' on command line.)
exec master.dbo.xp_cmdshell 'bcp Test2.dbo.TestTableImport in C:\TestTable .csv -c -T -t 'But the following works..Any thoughts?
BULK INSERT TestTableImport FROM 'c:\TestTable.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO
You have not specified the field terminator on the BCP command line. Try
EXEC master.dbo.xp_cmdshell 'bcp Test2.dbo.TestTableImport in C:\TestTable.csv -c -T -t, -r\r\n'
Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/