Home All Groups Group Topic Archive Search About

execute long sql script

Author
4 May 2009 8:18 PM
Pingx
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
Author
4 May 2009 8:51 PM
Russell Fields
Read about SQLCMD.exe, a command line tool.  E.g.

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

RLF

Show quoteHide quote
"Pingx" <Pi***@discussions.microsoft.com> wrote in message
news:69342935-51B9-4BBF-9594-49C49F3537C5@microsoft.com...
> 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
Are all your drivers up to date? click for free checkup

Author
4 May 2009 9:31 PM
Pingx
Thanks Russel.
How about OSQL?

Pingx
Show quoteHide quote
"Pingx" wrote:

> 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
Author
4 May 2009 10:08 PM
Erland Sommarskog
Pingx (Pi***@discussions.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, esq***@sommarskog.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/prodinfo/previousversions/books.mspx
Author
4 May 2009 10:36 PM
Pingx
Thanks for your help.
Pingx
Show quoteHide quote
"Erland Sommarskog" wrote:

> Pingx (Pi***@discussions.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, esq***@sommarskog.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/prodinfo/previousversions/books.mspx
>
>
Author
7 May 2009 12:06 AM
Pingx
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

Show quoteHide quote
"Pingx" wrote:

>
> Thanks for your help.
> Pingx
> "Erland Sommarskog" wrote:
>
> > Pingx (Pi***@discussions.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, esq***@sommarskog.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/prodinfo/previousversions/books.mspx
> >
> >
Author
7 May 2009 10:36 PM
Erland Sommarskog
Pingx (Pi***@discussions.microsoft.com) writes:
> 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, esq***@sommarskog.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/prodinfo/previousversions/books.mspx
Author
7 May 2009 11:39 PM
Andrew J. Kelly
Do you have SET NOCOUNT ON at the beginning of the script?

--
Andrew J. Kelly    SQL MVP
Solid Quality Mentors


Show quoteHide quote
"Pingx" <Pi***@discussions.microsoft.com> wrote in message
news:67355C57-F930-4069-8A46-344EA842E8CF@microsoft.com...
> 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 (Pi***@discussions.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, esq***@sommarskog.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/prodinfo/previousversions/books.mspx
>> >
>> >
Author
18 May 2009 7:33 AM
Manpreet Singh
you can use vedit

http://www.vedit.com/


Show quoteHide quote
"Pingx" wrote:

> 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

Bookmark and Share