I got a requirement to create batch file with multiple optional parameters.
Example
MyTestSqlBatch.bat ServerName DatabaseName [UserId] [Password] [Command] [parameter]
here ServerName
and DatabaseName
are mandatory. And
UserId, Password
are optional for Windows authentication users.
Command
is also optional parameter (some times I need to call batch file with Command
parameter for Windows authentication). if I want to run my batch file for SQL authentication then I want to pass UserId password also.
Can any one give suggest on this, how to create named parameters (or) any best way to handle this?
Thanks,