Thursday, April 14, 2011

Run SP's or Select Queries by SQLCMD

SQLCMD command utility requires a sql script file with sql statements or Stored Procedures.SQLCMD will invoke SQL file in command prompt and run the scripts inside the *.SQL file as run normally by using SQL Server management Studio.
-- Go to Command Prompt
-- Go to C drive C:\>
-- Type the following command inorder to run SQL script
FileName.sql --> Contains either select statement or set of stored procedures
-- From local systemsqlcmd -S -i \\ServerName\Foldername\FileName.sql-- Running On Serversqlcmd -S -i C:\FileName.sql

No comments:

Post a Comment