0

I wasn't sure which section to post this under but I am working on an assignment in SQL and have created a batch file to make the tables, load the data into the tables, and then sends several queries to sql to get results. Is there a way I can write the output from this batch file to a .txt file somewhere on my system? I have tried to look this up in several different places but have not had too much luck understanding them. I am fairly new to SQL.

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by smantscheff
0

To write your output in a text file follow these steps
1-Open query analyzer.
2-Go to Query
3-select Result to file
After doing this when you will execute your queries sql qill will prompt to ask the file name.

1

Use standard input/output direction from the console window. If your script resides in myscript.sql and your output should go in output.txt, enter mysql -u[I]username[/I] -p[I]password[/I] [I]database[/I] < myscript.sql > output.txt on the command line.

Edited by smantscheff: n/a

0

smantscheff - I understood your suggestion and tried it out but the output.txt file had what appears to be the help topics for MySQL rather than the output from the batch-file I entered

0

Then you have at least one parameter wrong in your mysql call. Try mysql -uusername -ppassword database from the command line first. When that works, add the redirections.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.