SQl command in batch file | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

SQl command in batch file

Hi, Anyone got any idea what command I would use in a batch file to retrieve a certain value from a table in sql database? The plan is to save this retrieved value as a variable and use again within batch file. Possible or not? Thanks in advance
you can use SQLCMD -q "Your Query" to query sql server from batch file Madhu
Thanks, Have you any idea how I could save the result to a variable or is it even possible in a batch file? Thanks again
quote:Originally posted by madhuottapalam you can use SQLCMD -q "Your Query" to query sql server from batch file Madhu

could u pse explain your actual requirement…. Madhu
I am trying to retrieve an integer (current version of software) from a sql 2000 table. When I retrieve this I need to keep it as a variable so I can run certain scripts for particular versions of the software. (i.e. If version = 9.8 I will run script 1 and if version = 9.9 I will run script 2 and so on) The reason for this is to upgrade the version of the software by using a batch file. Hope this makes sense..
quote:Originally posted by madhuottapalam could u pse explain your actual requirement…. Madhu

]]>