﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / SQLCMD mode in a job step? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 10:06:24 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>That was awsome. Thank you so much</description><pubDate>Tue, 29 Jan 2013 08:00:44 GMT</pubDate><dc:creator>tomiapi</dc:creator></item><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>Try -Q instead of -q</description><pubDate>Tue, 29 Jan 2013 06:50:01 GMT</pubDate><dc:creator>magasvs</dc:creator></item><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>you don't need to add the -E parameter if you don't specify password and username. it uses windows authentication by default. I got it to run when i changed this :  "sqlcmd -S SQLSRV -i C:\Tests\TestCMD.sql"to this: sqlcmd -S SQLSRV -q "C:\Tests\TestCMD.sql"I executed a tiny query that respond on the Command promt console inmediatly but my Job starts running and never finishes.. has this happened to you ? thanksTom</description><pubDate>Tue, 29 Jan 2013 06:08:15 GMT</pubDate><dc:creator>tomiapi</dc:creator></item><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>You can use Windows authentication - you need to add -E parameter (no need to use username and password).</description><pubDate>Mon, 28 Jan 2013 20:10:56 GMT</pubDate><dc:creator>magasvs</dc:creator></item><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>"Yes, you can do it.Create "Operating system" type job step: "sqlcmd -S SQLSRV -i C:\Tests\TestCMD.sql"example of TestCMD.sql file ::Setvar BackFldr "C:\TestCMD\"!!if exist C:\TestCMD\*.bak (move K:\TestCMD\*.bak K:\TestCMD\ARCHIVE\) ELSE (ECHO No files found)"My job is not working don't you need to specify user and password for sqlserver?</description><pubDate>Fri, 25 Jan 2013 13:20:28 GMT</pubDate><dc:creator>tomiapi</dc:creator></item><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>I guess its close, thanks for your input</description><pubDate>Tue, 11 May 2010 17:04:54 GMT</pubDate><dc:creator>glugingboulder</dc:creator></item><item><title>RE: SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>Yes, you can do it.Create "Operating system" type job step: "sqlcmd -S SQLSRV -i C:\Tests\TestCMD.sql"example of TestCMD.sql file ::Setvar BackFldr "C:\TestCMD\"!!if exist C:\TestCMD\*.bak (move K:\TestCMD\*.bak K:\TestCMD\ARCHIVE\) ELSE (ECHO No files found)</description><pubDate>Tue, 11 May 2010 08:28:22 GMT</pubDate><dc:creator>magasvs</dc:creator></item><item><title>SQLCMD mode in a job step?</title><link>http://www.sqlservercentral.com/Forums/Topic919407-146-1.aspx</link><description>Is there anyway to get SQLCMD mode to run in a job step?I find it a quick method to execute *.sql scripts with :r "C:\path\file.sql"Also quick access using !! to execute cmdshellI know there are methods using xp_cmdshell just not as elegant as SQLCMD mode in query editor</description><pubDate>Mon, 10 May 2010 21:06:55 GMT</pubDate><dc:creator>glugingboulder</dc:creator></item></channel></rss>