Quantcast
Channel: BCP error
Viewing all articles
Browse latest Browse all 5

BCP error

$
0
0

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/


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>