<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Interesting Observation &#8211; Using sqlcmd From SSMS Query Editor</title>
	<atom:link href="http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Wed, 22 May 2013 19:03:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: CarrieAnne</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-472010</link>
		<dc:creator><![CDATA[CarrieAnne]]></dc:creator>
		<pubDate>Thu, 09 May 2013 13:56:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-472010</guid>
		<description><![CDATA[A little late response, but to help any subsequent readers I believe you need to put a GO after each set of SQL commands if you want the output from them to appear in the expected order, otherwise the SQL Batch isn&#039;t completed until after the OS commands have been run.]]></description>
		<content:encoded><![CDATA[<p>A little late response, but to help any subsequent readers I believe you need to put a GO after each set of SQL commands if you want the output from them to appear in the expected order, otherwise the SQL Batch isn&#8217;t completed until after the OS commands have been run.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #011 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-406701</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #011 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 12 Jan 2013 01:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-406701</guid>
		<description><![CDATA[[...] Interesting Observation – Using sqlcmd From SSMS Query Editor [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Interesting Observation – Using sqlcmd From SSMS Query Editor [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-54631</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Sun, 09 Aug 2009 05:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-54631</guid>
		<description><![CDATA[@Atin, 

When you see results in Results to Grid : You will see only result set returned by the query in result, but any message attached to it, like command completed successfully or any error that occurred while executing that sql statements, will be displayed in message tab. 

When you see results in Results to Text: You will result set returned by query and any message about that query in the same tab. 

That is why you will see one more tab called messages when you set your results window to be Results to Grid.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@Atin, </p>
<p>When you see results in Results to Grid : You will see only result set returned by the query in result, but any message attached to it, like command completed successfully or any error that occurred while executing that sql statements, will be displayed in message tab. </p>
<p>When you see results in Results to Text: You will result set returned by query and any message about that query in the same tab. </p>
<p>That is why you will see one more tab called messages when you set your results window to be Results to Grid.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Atin</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-54613</link>
		<dc:creator><![CDATA[Atin]]></dc:creator>
		<pubDate>Sat, 08 Aug 2009 09:46:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-54613</guid>
		<description><![CDATA[Dear All,
I observed a very interesting thing can anyone please explain this..

After running the query in &quot;Results to text&quot; mode I got the answer in Results tab no matter whether OS command or SQL command

But when i run the query in &quot;Results to Grid&quot; mode I get a new tab as &quot;Messages&quot; for OS commands output

Please explain

Thanx n Regards
Atin]]></description>
		<content:encoded><![CDATA[<p>Dear All,<br />
I observed a very interesting thing can anyone please explain this..</p>
<p>After running the query in &#8220;Results to text&#8221; mode I got the answer in Results tab no matter whether OS command or SQL command</p>
<p>But when i run the query in &#8220;Results to Grid&#8221; mode I get a new tab as &#8220;Messages&#8221; for OS commands output</p>
<p>Please explain</p>
<p>Thanx n Regards<br />
Atin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JS</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-53262</link>
		<dc:creator><![CDATA[JS]]></dc:creator>
		<pubDate>Thu, 25 Jun 2009 21:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-53262</guid>
		<description><![CDATA[I would like to know the answer to Mohan&#039;s question of programmatic access to SqlCMD MODE also...and I would very much like to know how to set a variable dynamically for the :CONNECT command. I already know about :SETVAR but I need to know how to pump a sql variable into :SETVAR:

declare @serv sysname
select @serv=servname from ServerTable
:SETVAR serv @serv --THIS WILL NOT WORK!
:CONNECT $(serv)...

thanks MUCH 
-JS]]></description>
		<content:encoded><![CDATA[<p>I would like to know the answer to Mohan&#8217;s question of programmatic access to SqlCMD MODE also&#8230;and I would very much like to know how to set a variable dynamically for the :CONNECT command. I already know about :SETVAR but I need to know how to pump a sql variable into :SETVAR:</p>
<p>declare @serv sysname<br />
select @serv=servname from ServerTable<br />
:SETVAR serv @serv &#8211;THIS WILL NOT WORK!<br />
:CONNECT $(serv)&#8230;</p>
<p>thanks MUCH<br />
-JS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mohan</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-52460</link>
		<dc:creator><![CDATA[mohan]]></dc:creator>
		<pubDate>Wed, 27 May 2009 04:52:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-52460</guid>
		<description><![CDATA[Hi all,

i am facing one problem with SQL CMD.

problem is:

I want to automate some SQL CMD script.

For successfull execution of this job i need enable the SQL CMD MODE before executing the SQLCMD script
 (like, :connect, :r ....etc.).

I dont know how to enable SQL CMD MODE using &quot;T-SQL&quot; commands.

Please help me as this very urgent/imp to me.


Thanks,
Mohan]]></description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>i am facing one problem with SQL CMD.</p>
<p>problem is:</p>
<p>I want to automate some SQL CMD script.</p>
<p>For successfull execution of this job i need enable the SQL CMD MODE before executing the SQLCMD script<br />
 (like, :connect, :r &#8230;.etc.).</p>
<p>I dont know how to enable SQL CMD MODE using &#8220;T-SQL&#8221; commands.</p>
<p>Please help me as this very urgent/imp to me.</p>
<p>Thanks,<br />
Mohan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rabbit</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-45909</link>
		<dc:creator><![CDATA[Rabbit]]></dc:creator>
		<pubDate>Thu, 22 Jan 2009 20:06:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-45909</guid>
		<description><![CDATA[Resend. Sorry about it.

This is what I got using SB&#039;s snytax, it seems that the OS commands not working properly:


ServerVersion
—————————————————————————————————————————————————————————————————————————————————————-
Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)
Feb 9 2007 22:47:07
Copyright (c) 1988-2005 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)

(1 row(s) affected)

The filename, directory name, or volume label syntax is incorrect.
Thu 01/22/2009
CurrentTime
———————–
2009-01-22 14:50:59.353

(1 row(s) affected)


Please advise.

Thank you very much!]]></description>
		<content:encoded><![CDATA[<p>Resend. Sorry about it.</p>
<p>This is what I got using SB&#8217;s snytax, it seems that the OS commands not working properly:</p>
<p>ServerVersion<br />
—————————————————————————————————————————————————————————————————————————————————————-<br />
Microsoft SQL Server 2005 &#8211; 9.00.3042.00 (Intel X86)<br />
Feb 9 2007 22:47:07<br />
Copyright (c) 1988-2005 Microsoft Corporation<br />
Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)</p>
<p>(1 row(s) affected)</p>
<p>The filename, directory name, or volume label syntax is incorrect.<br />
Thu 01/22/2009<br />
CurrentTime<br />
———————–<br />
2009-01-22 14:50:59.353</p>
<p>(1 row(s) affected)</p>
<p>Please advise.</p>
<p>Thank you very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SB</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-45509</link>
		<dc:creator><![CDATA[SB]]></dc:creator>
		<pubDate>Fri, 09 Jan 2009 20:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-45509</guid>
		<description><![CDATA[This situation can be described in few ways. The basic is sqlcmd does not process sql command unless it find a sql terminator (like &#039;go&#039;). 
Take the following example. You will get the results in desired sequence.

SELECT @@Version ServerVersion
go
!! Dir &quot;C:\Documents and Settings&quot;
!! Date /T
SELECT GETDATE() CurrentTime
go]]></description>
		<content:encoded><![CDATA[<p>This situation can be described in few ways. The basic is sqlcmd does not process sql command unless it find a sql terminator (like &#8216;go&#8217;).<br />
Take the following example. You will get the results in desired sequence.</p>
<p>SELECT @@Version ServerVersion<br />
go<br />
!! Dir &#8220;C:\Documents and Settings&#8221;<br />
!! Date /T<br />
SELECT GETDATE() CurrentTime<br />
go</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - sqlcmd - Using a Dedicated Administrator Connection to Kill Currently Running Query Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-45478</link>
		<dc:creator><![CDATA[SQL SERVER - sqlcmd - Using a Dedicated Administrator Connection to Kill Currently Running Query Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Fri, 09 Jan 2009 01:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-45478</guid>
		<description><![CDATA[[...] SQL SERVER - Interesting Observation - Using sqlcmd From SSMS Query Editor [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER &#8211; Interesting Observation &#8211; Using sqlcmd From SSMS Query Editor [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry Hung</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-45475</link>
		<dc:creator><![CDATA[Jerry Hung]]></dc:creator>
		<pubDate>Thu, 08 Jan 2009 21:13:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-45475</guid>
		<description><![CDATA[One can set variable in SQLCMD mode too, if running T-SQL script in SQLCMD mode

:SETVAR ServerName “Server”
:SETVAR ManagementDatabase “MDW”
GO
:CONNECT $(ServerName)
GO

………….usual T-SQL code………….]]></description>
		<content:encoded><![CDATA[<p>One can set variable in SQLCMD mode too, if running T-SQL script in SQLCMD mode</p>
<p>:SETVAR ServerName “Server”<br />
:SETVAR ManagementDatabase “MDW”<br />
GO<br />
:CONNECT $(ServerName)<br />
GO</p>
<p>………….usual T-SQL code………….</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kearns</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-45408</link>
		<dc:creator><![CDATA[Kearns]]></dc:creator>
		<pubDate>Tue, 06 Jan 2009 15:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-45408</guid>
		<description><![CDATA[Bizarre. I have confirmed this. I wrote a command line program that allows me to use the c# DateTime.ToString and get the full time, I then called the following script:

SET nocount on
SELECT GETDATE() CurrentTime
!! c:\tools\datetime HH:mm:ss.ffffzzz

And it not only puts the results in the opposite order, but it runs them in the opposite order as shown in the results:

10:37:47.8240-05:00
CurrentTime
-----------------------
2009-01-06 10:37:47.880

Weird.]]></description>
		<content:encoded><![CDATA[<p>Bizarre. I have confirmed this. I wrote a command line program that allows me to use the c# DateTime.ToString and get the full time, I then called the following script:</p>
<p>SET nocount on<br />
SELECT GETDATE() CurrentTime<br />
!! c:\tools\datetime HH:mm:ss.ffffzzz</p>
<p>And it not only puts the results in the opposite order, but it runs them in the opposite order as shown in the results:</p>
<p>10:37:47.8240-05:00<br />
CurrentTime<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
2009-01-06 10:37:47.880</p>
<p>Weird.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://blog.sqlauthority.com/2009/01/06/sql-server-interesting-observation-using-sqlcmd-from-ssms-query-editor/#comment-45391</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Tue, 06 Jan 2009 07:50:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=1966#comment-45391</guid>
		<description><![CDATA[Here&#039;s a couple for starters - perhaps you might want to rename an old DB backup before running a new one?

Or you might want to control Windows services, stopping one before running some maintenance and then restarting.]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s a couple for starters &#8211; perhaps you might want to rename an old DB backup before running a new one?</p>
<p>Or you might want to control Windows services, stopping one before running some maintenance and then restarting.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
