Home > Archive > MS SQL Server > January 2006 > SQL ResultSet to a txt file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL ResultSet to a txt file
Sha

2006-01-30, 3:23 am

Hi,
Using T-SQL is it posible to write the resultset of a select statement to a
text file?.
If possible please give me the details.

Thanks in advance.

Regards,
Sha
Jens

2006-01-30, 3:23 am

You have to open up a cmdshell for this to save the results to a file,
something like:

xp_cmdshell 'OSQL -E -Q"Select * FROM SomeTable"
-O"C:\myoutputfile.txt"'

HTH, Jens Suessmeyer.

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com