954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

BCP error on a database with name in two words

Hi,

Why a database with two words separated by a space causes problem to a bcp command like below :

EXEC xp_cmdshell 'bcp [History Data].dbo.InventoryValuation_FP102008" out D:\test.txt -q -T -c'

Do you guys met with the same problem before? If yes, how to solve it.

Many thanks.

ggk517
Newbie Poster
2 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

Sorry i think there is a typo (the " should not be exist) in my earlier post. Pls read below for further info:


This command works perfectly :-

EXEC xp_cmdshell 'bcp History.dbo.InventoryValuation_FP102008 out D:\test.txt -q -T -c'

But, if i renamed the database from "History" to "History Data" and ran this command :-

EXEC xp_cmdshell 'bcp [History Data].dbo.InventoryValuation_FP102008 out D:\test.txt -q -T -c'

It returned this error msg:

Copy direction must be either 'in', 'out' or 'format'.


Thanks!

ggk517
Newbie Poster
2 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

Have you considered simply not having the space in the name? Instead, try substituting an underscore ("_").

In my experience, having a space in a table/column/stored procedure/file/pretty much anything else name is asking for problems like this.

RDWilson2
Newbie Poster
15 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You