0

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.

MC ND
  • 69,615
  • 8
  • 84
  • 126
boomcubist
  • 770
  • 1
  • 7
  • 15

1 Answers1

0

Do it all in TSQL because you can nest stored procedures

Chris Allen
  • 605
  • 3
  • 4