Connecting Tech Pros Worldwide Help | Site Map

BCP error on a database with name in two words

Newbie
 
Join Date: Jul 2008
Posts: 2
#1: Jul 24 '08
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.
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Jul 24 '08

re: BCP error on a database with name in two words


If that's your actual command, I think you have a problem with the quotes, not the database name.

-- CK
Newbie
 
Join Date: Jul 2008
Posts: 2
#3: Jul 24 '08

re: BCP error on a database with name in two words


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!
Reply