Question

Is it possible to write a batch file that will check and return a value from SQL and run a particular set of scripts depending of the return value from SQL.

For example,

If this returns a version 5 value:

sqlcmd -U *** -P *** -S127.0.0.1 -Q "checkversion.sql" 

Run version 5 scripts, but ignore 1, 2, 3 and 4.

But if this returns a version 6 value:

sqlcmd -U *** -P *** -S127.0.0.1 -Q "checkversion.sql" 

Run version 5 and version 6 scripts but ignore 1, 2, 3 and 4.

Was it helpful?

Solution

Do it all in TSQL because you can nest stored procedures

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top