Running Multiple procedures using SQLSMD

  • Hi All,

    Can I execute multiple procedures/functions thru SQLCMD....

    Regards,
    [font="Verdana"]Sqlfrenzy[/font]

  • Ofcourse, you need to provide the input file .sql file and enlist all your SP execs in it.

  • Hi,

    You can create a txt or .sql file & include all the commands there. then you may refer to this file while using the SQLCMD ... I have used this in one of our requirements.

    sqlcmd -S localhost\SQLEXP -i C:\SQL_DB\DB_Backup_script.sql

    In the above command,

    -S specifies the server\instance name for SQL Server

    -i this specifies the input command file --> Here you have to give the .sql file where you are using multiple stored procedures.

    Have A Nice Day !!!

    ----------------------------------------------------------------
    **"There is only one difference between dream and aim. Dream requires Soundless sleep to see…Where as Aim Requires Sleepless Efforts to Achieve":-) **

  • After connecting (sqlcmd -Sserver\instance, etc.), you can even PASTE MULTILINE TEXT in a single paste, such as an entire alter procedure script or stack of other commands (including "go" statements whenever you like, including at the end) to execute it all. You can type freehand or paste more commands as you like. When done, type "quit" to exit the connection. When working with clients over pcAnywhere (or GoToMyPC, etc.), you need only transfer text in the clipboard. You don't have to transfer or create a file.

    (With a SQL login, you can leave off the password parameter from the sqlcmd statement, letting sqlcmd prompt you and conceal the text.)

    (To paste multiline in a command window, you can click on the icon in the top left corner of the command window.)

Viewing 4 posts - 1 through 3 (of 3 total)

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