﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Programming / SMO/RMO/DMO  / Using SQLCMD script in SMO / 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>Sat, 18 May 2013 01:21:44 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Using SQLCMD script in SMO</title><link>http://www.sqlservercentral.com/Forums/Topic1161673-22-1.aspx</link><description>Many thanks for your reply.I had considered that option but I was not allowed to use it (there were concerns that SQLCMD might not exist on the client PC).In the end, I preprocessed the script file by commenting out the SQLCMD syntax and replacing the variables with the assigned values.That was adequate and worked.</description><pubDate>Thu, 08 Sep 2011 12:17:51 GMT</pubDate><dc:creator>apatel903</dc:creator></item><item><title>RE: Using SQLCMD script in SMO</title><link>http://www.sqlservercentral.com/Forums/Topic1161673-22-1.aspx</link><description>AFAIK, SMO does not support SQLCMD script such as !!, :*, etc.You might want to create a SQLCMD process in your C# application and pass the SQLCMD script as a input parameter. SQLALX[url=http://www.sqlmgmt.com]http://sqlmgmt.com[/url][url=http://sqlbeyond.blogspot.com]http://sqlbeyond.blogspot.com[/url]</description><pubDate>Thu, 08 Sep 2011 12:05:27 GMT</pubDate><dc:creator>SQLALX</dc:creator></item><item><title>Using SQLCMD script in SMO</title><link>http://www.sqlservercentral.com/Forums/Topic1161673-22-1.aspx</link><description>Hello,I have a C# program which uses SMO to submit tsql to SQL Server 2008 R2 for execution. The tsql is read in from a script file and this works fine.However if I give it a script file which contains some sqlcmd syntax I get an exception saying "Incorrect syntax near ':' .Is it the case that SMO does not support script files with sqlcmd syntax?If that is the case, please can anyone you suggest alternatives.Thank you,Anil.</description><pubDate>Thu, 18 Aug 2011 05:30:34 GMT</pubDate><dc:creator>apatel903</dc:creator></item></channel></rss>