Pete's Windows, Office, VB & SQL Blog

Problems I have solved (or not) and good ideas I've found

Posts Tagged ‘NativeError = 4060

bcp and brackets [x_x].[dbo].[T_TableName] SQLState = 37000, NativeError = 4060

leave a comment »

Bizarrely the format [x_x].[dbo].[TableName] in the BCP command gives

SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login ‘[x_x]‘. Login fails.

however in the format  x_x.dbo.[TableName] it works.  Which seems to contradict the MSDN advice.

Full working command line:

C:\Documents and Settings\Peter>bcp x_x.dbo.[T_TableName] out “Z:\Packages\Db\T_TableName.TXT”  -S SERVER -T -f “Z:\Packages\generate packages\T_TableName.FMT”

Full failing command line:

C:\Documents and Settings\Peter>bcp [x_x].[dbo].[T_TableName] out “Z:\Packages\Db\T_TableName.TXT”  -S SERVER -T -f “Z:\Packages\generate packages\T_TableName.FMT”

Written by fisherpeter

2009 November 20 at 11:25

Follow

Get every new post delivered to your Inbox.