Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 BCP utility

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-10 : 19:32:31
Elvira writes "I am trying to Execute the bcp Call with xp_cmdshell. Here is a query that I want to run:
select * from po where fk_account_number > 52

The .bat file that is being created looks like this:
bcp select * from po where fk_account_number -SEDEV -U -c -t, -P

Unfortunately my query is trunkated at fk_account_number field just before ">" sign.

Does anybody knows why?
Thanks,
Ella

P.S. I tried to use char(62) instead of ">" but it did not help either."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-10 : 20:19:19
Try this:

bcp "select * from po where fk_account_number>52" queryout c:\data.txt -SEDEV -U -c -t, -P

When indicating a SQL query, you must enclose it in double quotes and use the "queryout" flag. The > character is also a DOS redirection operator, if it is NOT enclosed in quotes then the command will not interpret it correctly.

Go to Top of Page
   

- Advertisement -