2012年2月25日星期六

BCP command Issue

Hi all,
The command is as follows:
BCP asdos+_reports..StageCONTACTINFO OUT C:\16E8.tmp -w -b10000 -t"|" -r\n
-Sblrkec28791d\sqlserver -Uadmin -Padmin -eC:\ERRCONTACTINFO.txt
Here, since the first argument(database name) has a special char '+' in
it, the command gives a syntax error. How can i escape it? Double
quotes"",
[] didnt work!! Pls help!
TIA
Here is the way to go:
Run it via script file. I tried it and it worked.
Exec Master..xp_cmdshell "bcp test+3test.dbo.t1 out
E:\temp\t1.txt -t""|"" -r\n -SNYDAC1 -Unyloadtest -Pnyloadtest -eE:\Temp\err
or.txt"
Watch for double quotes embedded inside the double "".
"Sundar" <Sundar@.discussions.microsoft.com> wrote in message
news:8B60DCD7-C961-4FEC-9795-14DE1FC91C5B@.microsoft.com...
> Hi all,
> The command is as follows:
> BCP asdos+_reports..StageCONTACTINFO OUT
C:\16E8.tmp -w -b10000 -t"|" -r\n
> -Sblrkec28791d\sqlserver -Uadmin -Padmin -eC:\ERRCONTACTINFO.txt
> Here, since the first argument(database name) has a special char '+' in
> it, the command gives a syntax error. How can i escape it? Double
> quotes"",
> [] didnt work!! Pls help!
> TIA
>

没有评论:

发表评论