2012年3月25日星期日

BCP Syntax

Please I need some help with bcp syntax. I have the default installation of SQL Express on my system. Also, I'm using windows authentication. Here are some syntax tried:

bcp database.dbo.table out "c:\table.dat" -U? -P? -c

I'm not sure what the user name and password should be but I've tried my windows user id and password without any success.

bcp database.dbo.table out "c:\table.dat" -T -c

I'm not sure if this is a trusted connection,

Do I have to be in App_data directory where my database reside.

There are 2 authentication modes that bcp supports:

a) SQL Server authentication in which case you have to specify your SQL Server login and password, say your SQL Server login ID is foo and password is bar then you should specify -Ufoo -Pbar.

b) If you can login to SQL Server using Windows authentication, then just specify -T and it will used Trusted connection.

Thanks

没有评论:

发表评论