Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Executing SQL Script without SQL Management Studio

Author  Topic 

Sivangari
Starting Member

16 Posts

Posted - 2010-10-06 : 01:46:57
Hi,
I need to run a .sql file without opening that .sql file in SQL Management studio.Can any one help me please.

Sachin.Nand

2937 Posts

Posted - 2010-10-06 : 01:57:41
You can use Sqlcmd.Not sure about proper syntax though.its something like this

sqlcmd -S Servername -U username -P password -d databasename -i'input sql filename' -o 'o/p filename'


PBUH

Go to Top of Page

Sivangari
Starting Member

16 Posts

Posted - 2010-10-06 : 02:42:18
Hi,
Thanks for your kindly help.But can u give me the format. i cannot find it.

Thanks.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-10-06 : 02:44:49
Just google it or look for it in BOL.I am sure you can find it.

PBUH

Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-10-06 : 04:29:40
RTM
http://msdn.microsoft.com/en-us/library/ms162773.aspx

First hit on google for sqlcmd
Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-10-06 : 04:31:04
And the second hit is a tutorial explaining how to use it.
http://msdn.microsoft.com/en-us/library/ms170207.aspx

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -