To run a set of sql statements(not stored procedure..),using a batch file?

  • Hi,

    Can you give me an example how to run a set of sql statements(not stored procedure..),using a batch file?

    Thanks,

    venu

  • Save the SQL statements in a .sql file and use SQLCMD.EXE to execute this file from the batch file

    -Vikas Bindra

  • I am connecting to the SQL server as follows.

    In a batch file I have written as follows.

    sqlcmd -s ip,port -U usename -P passwrd -Q "Query"

    can you tell me where and how to include .sql file.

    - Venu

  • sqlcmd -s ip,port -i [file path] -U usename -P passwrd -Q "Query"

    -Vikas Bindra

  • Thanks. I am able to call .sql file.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply