views:

125

answers:

1

Hello,

i need to call sqlcmd from stored procedure to export table to text file?

+1  A: 

by the following way you can do this

exec master..xp_cmdshell 'echo pranay test application > d:\file.txt'

more about this : http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-to-copy-data-append-data-into-files-

Pranay Rana
i can't append to file like this
aron
The > redirect overwrites, >> will append
Alex K.