dbTalk Databases Forums  

execute long sql script

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss execute long sql script in the microsoft.public.sqlserver.tools forum.



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

Default execute long sql script - 05-04-2009 , 03:18 PM






Hi,
I have a very big sql script that I can not opne with Mangement Studio due
to the size.
What other tool can I use to execute this script? All it has are INSERT
statements.

Thanks,

Ping

Reply With Quote
  #2  
Old   
Russell Fields
 
Posts: n/a

Default Re: execute long sql script - 05-04-2009 , 03:51 PM






Read about SQLCMD.exe, a command line tool. E.g.

SQLCMD -S Servername -E -i yourscriptfilepath -o youroutputfilepath

RLF

"Pingx" <Pingx (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,
I have a very big sql script that I can not opne with Mangement Studio due
to the size.
What other tool can I use to execute this script? All it has are INSERT
statements.

Thanks,

Ping


Reply With Quote
  #3  
Old   
Pingx
 
Posts: n/a

Default RE: execute long sql script - 05-04-2009 , 04:31 PM




Thanks Russel.
How about OSQL?

Pingx
"Pingx" wrote:

Quote:
Hi,
I have a very big sql script that I can not opne with Mangement Studio due
to the size.
What other tool can I use to execute this script? All it has are INSERT
statements.

Thanks,

Ping

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

Default RE: execute long sql script - 05-04-2009 , 05:08 PM



Pingx (Pingx (AT) discussions (DOT) microsoft.com) writes:
Quote:
Thanks Russel.
How about OSQL?
OSQL should work find too. The command line would be same as Russell
posted.

In addition, I would recommend that you use the -I option with both
tools. This enables the setting QUOTED_IDENTIFIER which is default
with other means of connection, and which is required for some
functionality. Less source for confusion this way.


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

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #5  
Old   
Pingx
 
Posts: n/a

Default RE: execute long sql script - 05-04-2009 , 05:36 PM




Thanks for your help.
Pingx
"Erland Sommarskog" wrote:

Quote:
Pingx (Pingx (AT) discussions (DOT) microsoft.com) writes:

Thanks Russel.
How about OSQL?

OSQL should work find too. The command line would be same as Russell
posted.

In addition, I would recommend that you use the -I option with both
tools. This enables the setting QUOTED_IDENTIFIER which is default
with other means of connection, and which is required for some
functionality. Less source for confusion this way.


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

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #6  
Old   
Pingx
 
Posts: n/a

Default RE: execute long sql script - 05-06-2009 , 07:06 PM



Running the insert sql script in SQLCMD is a lot slower than running the same
stateent in Management Studio, Is there any reason why?

Ping

"Pingx" wrote:

Quote:
Thanks for your help.
Pingx
"Erland Sommarskog" wrote:

Pingx (Pingx (AT) discussions (DOT) microsoft.com) writes:

Thanks Russel.
How about OSQL?

OSQL should work find too. The command line would be same as Russell
posted.

In addition, I would recommend that you use the -I option with both
tools. This enables the setting QUOTED_IDENTIFIER which is default
with other means of connection, and which is required for some
functionality. Less source for confusion this way.


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

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



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

Default RE: execute long sql script - 05-07-2009 , 05:36 PM



Pingx (Pingx (AT) discussions (DOT) microsoft.com) writes:
Quote:
Running the insert sql script in SQLCMD is a lot slower than running the
same stateent in Management Studio, Is there any reason why?
But you said that you could not run in Mgmt Studio at all?

I don't see why SQLCMD would be slower. But there is a whole lot you have
not told us about, so there could be all sorts of reasons.

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

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx



Reply With Quote
  #8  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: execute long sql script - 05-07-2009 , 06:39 PM



Do you have SET NOCOUNT ON at the beginning of the script?

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Pingx" <Pingx (AT) discussions (DOT) microsoft.com> wrote

Quote:
Running the insert sql script in SQLCMD is a lot slower than running the
same
stateent in Management Studio, Is there any reason why?

Ping

"Pingx" wrote:


Thanks for your help.
Pingx
"Erland Sommarskog" wrote:

Pingx (Pingx (AT) discussions (DOT) microsoft.com) writes:

Thanks Russel.
How about OSQL?

OSQL should work find too. The command line would be same as Russell
posted.

In addition, I would recommend that you use the -I option with both
tools. This enables the setting QUOTED_IDENTIFIER which is default
with other means of connection, and which is required for some
functionality. Less source for confusion this way.


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

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinf...ons/books.mspx




Reply With Quote
  #9  
Old   
Manpreet Singh
 
Posts: n/a

Default RE: execute long sql script - 05-18-2009 , 02:33 AM



you can use vedit

http://www.vedit.com/


"Pingx" wrote:

Quote:
Hi,
I have a very big sql script that I can not opne with Mangement Studio due
to the size.
What other tool can I use to execute this script? All it has are INSERT
statements.

Thanks,

Ping

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.