June 25, 2003 at 10:47 am
Can someone tell me what is wrong with this bcp statement?
bcp "SELECT s.banner, h.hostname FROM service s, host h where checkbyte = 0" queryout "DataProducts.txt" -c -SMAZZY -dCometDB -Usa -Ppassword
I need to write a stored procedure that will be called by an application and only bcp the rows that have checkbyte = 0.
June 25, 2003 at 11:01 am
Can you post the error returned?
I Don't see any where condition for the join.
Execute the select without using bcp, to check that returns any results, and also that it is what you espect to bco out.
I would suggest to use a full path to specify the output file, because if you run the bcp from the sp with xp_cmdshell, then it will create the file in the \winnt\system32 directory.Unless you specify the path.
June 26, 2003 at 6:22 am
I tried it a again:
use master
exec xp_cmdshell 'bcp "select * from dbname.owner.table where checkbit = 0" queryout e:\products.txt -c -Sserver -Usa -Ppassword'
I get as an error the format for writing bcp commands...?
June 26, 2003 at 7:52 am
Thanks for your input I realized the problem...I had to also include the Dbname.table.columnname in the where clause..
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply