Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCP

Status
Not open for further replies.

laidback313

Programmer
Jan 9, 2001
7
US
Does anyone know why I'm getting this error when using BCP:
-Incorrect syntax near '9539'-

Here's the BCP syntax I'm using:
(bcp 9539_dev.dbo.table out export.txt -c -S myServer -U user -P password)

Only thing that changed on the server was that 9539_dev used to be the default DB. It was removed as the default by our DBA. Now I can't BCP in or out within that database. However I can BCP in and out to any other DB within the same sql server. Is it because the name of the DB starts with a NUMBER not a CHARACTER? If so, is there a way around that, i.e. enclose the DB name in brackets or single/double qoutes? Or will I have to rename the DB to start with a Character?

Thanks,

cM
 
try
(bcp "9539_dev.dbo.table" out "export.txt" -c -S"myServer" -U"user" -P"password")
AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
what was the error message now? AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
can I see the hole line? AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
have you tryed:
exec master..xp_cmdshell 'bcp "[9539_dev].dbo.table" out "export.txt" -c -S"myServer" -U"user" -P"password"' AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
Al,

Thanks for all the help. It was determined that the non-standard naming convention that was used to name the DB originally was the cause of the problem when the DB is not set to the default. Therefore having to call the DB explicity, in which case, command line BCP doesn't like. No problem though, I will rename the DB to standard and keep going.

Thanks again for you time,

cM
 
Al,

I was watching Fear Factor last night. There was a guy named Al Almeida...who WON $50K, was that you?? If it was congrats and good work.

Just curious,

cM
 
I would say that the odds of that one Al Almeida to be me is so slim as the odds of finding another one with the same name as me in the US! did he also worked with databases? AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top