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

Is there a simple way to write the returned rows of a select statement to a file?

I have found one example where you can write a string to a file in SQL (http://www.simple-talk.com/code/WorkingWithFiles/spWriteStringTofile.txt), but the string max length is 8000 characters, and the table may be larger than that.

share|improve this question
What database system are you working with? –  squillman Oct 10 '11 at 15:18
His example looks like MS SQL Server... –  RobW Oct 10 '11 at 15:56
I am using SQL Server 2008 –  John Oct 11 '11 at 12:50

Your Answer


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

Browse other questions tagged or ask your own question.