Home Forums Programming General Creating database,stored procedures from batch file RE: Creating database,stored procedures from batch file

  • Hi.

    I believe you want to use SQLCMD instead of OSQL. I do not see a -v option for OSQL, but there is one in SQLCMD. I ran the below SQLCMD and worked fine....

    SQLCMD -m-1 -E -S Server\Instance -d HOLDB -i D:\batch\Server.sql -v tbname=employ -o hi.txt

    Also, as far as OSQL, Microsoft states..."This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use the feature. Use sqlcmd instead. For more information, see sqlcmd Utility."

    John