dbTalk Databases Forums  

Cannot execute SQLCMSD -i from a .bat file

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Cannot execute SQLCMSD -i from a .bat file in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Giulio Petrucci
 
Posts: n/a

Default Cannot execute SQLCMSD -i from a .bat file - 01-19-2011 , 03:48 AM






Hi there,

I have to execute some .sql script files against a SQL Server 2008.
If I type in my command line:

Quote:
sqlcmd -U ... -P ... -i my_script.sql -v var1=value1 ecc ecc
the script is executed. If I put this statement in a .bat file, the
statement isn't executed AND (and this is the weirdest part) the SQL
Servere Management Studio opens (!!) and the script code is shown inside
the query editor.
Could anyone help me?

Thanks,
Giulio

--

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Cannot execute SQLCMSD -i from a .bat file - 01-19-2011 , 05:33 AM






Giulio Petrucci (sisisi (AT) nonono (DOT) boh) writes:
Quote:
I have to execute some .sql script files against a SQL Server 2008.
If I type in my command line:

sqlcmd -U ... -P ... -i my_script.sql -v var1=value1 ecc ecc

the script is executed. If I put this statement in a .bat file, the
statement isn't executed AND (and this is the weirdest part) the SQL
Servere Management Studio opens (!!) and the script code is shown inside
the query editor.
Could anyone help me?
So how does the BAT file look like? From you description of what is
happening, it sounds as you have induced a line break in the command.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #3  
Old   
Giulio Petrucci
 
Posts: n/a

Default Re: Cannot execute SQLCMSD -i from a .bat file - 01-19-2011 , 07:12 AM



Hi Erland,

On 1/19/2011 12:33 PM, Erland Sommarskog wrote:
Quote:
So how does the BAT file look like? From you description of what is
happening, it sounds as you have induced a line break in the command.
You are right!
This is exactly what appened.

Thank you,
Giulio

--

Reply With Quote
  #4  
Old   
Giulio Petrucci
 
Posts: n/a

Default Re: Cannot execute SQLCMSD -i from a .bat file - 01-19-2011 , 07:32 AM



On 1/19/2011 2:12 PM, Giulio Petrucci wrote:
Quote:
You are right!
This is exactly what appened.
Happened. :-)

Ciao,
Giulio

--

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.