Thursday, May 31, 2012

SQLCMD Mode in Query Editor (!! for SQL CMD) Execute Operating System Command from SQL Server

By enabling the SQL CMD mode we can execute SQLCMD Scripts from the management studio along with T-SQL Statements.

We need to enable SQLCMD Mode to write sqlcmd scripts
SSMS -- Query Menu -- SQLCMD

After enabling the SQLCMD we can execute queries by using !!

select * from kalyandb..Items
select count(*) from kalyandb..Images

We can execute complete set from the Query Editor. Here we should remember one thing, if you enable SQLCMD, intellisense will not work.

No comments: