SQL server sqlcmd supports script variables that can be set in one of three ways:
- Locally in a script using
:setvar , as you do above - Passed script using the
-v option - Set as environment variables before running the script
In other words, you can replace %DataDrive& with $ (DataDrive) in the script and either set DataDrive as an environment variable before starting it, or pass it, for example. -v DataDrive=D:\ . to your script when working with sqlcmd .
Hevard s
source share