Jump to content
collinsit

SQL Query in Script

Recommended Posts

Does anyone know if there is some query in a script that will return all the SQL output, not just the first cell. I have tried most of the SQL functions and they don't seem to work.

 

The query I am trying to run is SHOW SLAVE STATUS\G. This should output a table of information. I want to be able to get that whole table so I can use a RegEx or something to parse out what I want. I know with a shell command I could do that but not sure how with an SQL, if it is even possible. Another option would be to send that to a file and read the file but I am not sure how to really do that either. I tried the output setting in MySQL and that doesn't seem to work.

 

Thanks

Share this post


Link to post
Share on other sites

You could output to CSV:

 

http://stackoverflow.com/questions/356578/how-to-output-mysql-query-results-in-csv-format

 

 

Otherwise, execute mysql.exe from command line (shell), but you would need to pass a valid LabTech credential pair into the command, and return your result with %shellresult%

 

Example:

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -N -B -u -p labtech -e "SELECT * FROM TABLE"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×