Friday, March 30, 2012

Saving results of query into text file

I need to save a results of query in a text file.
Ex.: select id, name from teacher into c:\teacher.txtMarcos,
Check the Osql.Exe command prompt utility in Books OnLine. It can save
output to a file.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Marcos Vieira" <anonymous@.discussions.microsoft.com> wrote in message
news:318EF59A-0057-420A-86CA-1F4F1F6BA8F8@.microsoft.com...
> I need to save a results of query in a text file.
> Ex.: select id, name from teacher into c:\teacher.txt|||http://www.aspfaq.com/2482
"Marcos Vieira" <anonymous@.discussions.microsoft.com> wrote in message
news:318EF59A-0057-420A-86CA-1F4F1F6BA8F8@.microsoft.com...
> I need to save a results of query in a text file.
> Ex.: select id, name from teacher into c:\teacher.txt|||Hi,
There are lots of options:
1. Execute the Query analyzer and use File - save option to save the file as
text.
2. Use OSQL or ISQL utilities to run the query from command prompt and
oue -o option save it in hard disk with text extension
3. Use BCP OUT utility with Queryout option to save the output to a text
file.
Note:
Refer books online for the details of each command.
Thanks
Hari
MCDBA
"Marcos Vieira" <anonymous@.discussions.microsoft.com> wrote in message
news:318EF59A-0057-420A-86CA-1F4F1F6BA8F8@.microsoft.com...
> I need to save a results of query in a text file.
> Ex.: select id, name from teacher into c:\teacher.txt

No comments:

Post a Comment