Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I m trying to write query result to txt file. Here is my code:

exec master..xp_cmdshell 'bcp "select * from Leasings" queryout "DHCPLog.txt" -c -t,-T MyServerIP' 

But the result is :

enter image description here

And there is no row in DHCPLog.txt. Do you have any suggestion about this?

KR,

Çağın

share|improve this question

1 Answer 1

I think that you are missing a space after the comma and that you need to use the -S flag to specify the server name because -T is not enough. A command similar to the following works for me here:

exec master..xp_cmdshell 'bcp "select * from Leasings" queryout "DHCPLog.txt" -c -t, -T -S MyServerIP'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.