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.
Jump to Post
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.txton the command line.
All 4 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.