aron
aron

Reputation: 1904

How to write or append to text file using sql?

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

Upvotes: 4

Views: 19951

Answers (1)

Pranay Rana
Pranay Rana

Reputation: 176956

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-

Upvotes: 6

Related Questions