Re: Batches

From: Andrew J. Kelly (sqlmvpnooospam_at_shadhawk.com)
Date: 11/24/04


Date: Wed, 24 Nov 2004 09:10:20 -0500

Mike,

As Tibor stated it will be one batch and not 7000 individual round trips.
But FYI, if you had included the additional information that you were
building a single string I could have answered that more appropriately. I
had no idea if you were creating a dataset and populating it with 7000 rows
or doing what just stated. Those two approaches are completely different as
the first will execute 7000 (or more) round trips, one for each row. While
it is certainly possible to provide too much information it helps on the ngs
to give as much relevant info as possible so as to minimize the guesswork
involved and to give more correct or appropriate answers.

-- 
Andrew J. Kelly  SQL MVP
"Mike" <noone@hotmail.com> wrote in message 
news:elKy7$e0EHA.3236@TK2MSFTNGP15.phx.gbl...
> This must be a common situation:
>
> I am building a string of SQL statements, eg:
>
> INSERT INTO x(y,z) VALUES(1,2); INSERT INTO x(y,z) VALUES(3,4); -- etc, 
> for 6998 more inserts
>
> Remember this is all as one long string in my C# application.  I am then 
> passing this whole string to SQL server like this:
>
> myComm.ExecuteNonQuery(sql);
>
> This is just the standard method of the built in .NET SQL Server data 
> provider.  All I want to know is whether this WHOLE STRING will be passed 
> to SQL server for processing (so only one network request for all the 
> inserts), or whether the SQL data provider client will parse the string, 
> and turn it into 7000 separate statements, and execute them on the server 
> individually (thus causing 7000 network requests).  Surely someone must 
> know the answer to this without me having to use a profiler?
>
> Thanks,
>
> Mike
>
>
> "Andrew J. Kelly" <sqlmvpnooospam@shadhawk.com> wrote in message 
> news:%23jl2OEd0EHA.3820@TK2MSFTNGP11.phx.gbl...
>> Why not use profiler to see exactly what ADO is doing.  I have no idea 
>> how you have this set up but more than likely it is 7000 individual 
>> insert statements.  Is this something you do often?  If so why not write 
>> the data to a flat file and then use BCP or BulkInsert to bulk load the 
>> data instead?
>>
>> -- 
>> Andrew J. Kelly  SQL MVP
>>
>>
>> "Mike" <noone@hotmail.com> wrote in message 
>> news:%23TFuCqb0EHA.1296@TK2MSFTNGP10.phx.gbl...
>>> Hi there.
>>>
>>> I'm using ADO.NET to execute a batch of 7000 inserts on my SQL Server 
>>> 2000 DB.  What I want to know is, does the ADO driver parse the batch 
>>> into indavidual statements, then send them one a a time to the server, 
>>> or is the batch just sent as one long text string and the parsing done 
>>> on the server side?
>>>
>>> Also, does anyone have any opinions on this method of performing a large 
>>> number of inserts, as opposed to using a parametized query?  I was 
>>> thinking that a batch may be faster if it is parsed on the server, as 
>>> there would be only one request between client and server, whereas on a 
>>> parametized query, there are 7000 trips between client and server.  Am I 
>>> crazy?
>>>
>>> Mike
>>>
>>
>>
>
> 


Relevant Pages

  • Re: Address book data lookup (maybe javascript)
    ... That would not involve any trip to the server - the only thing ... If you type Johny, it should position itself onto Johny Roe. ... interogate the SQL server database. ... because I need to look up the string into SQL ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: HELP PLEASE ~ ???
    ... You can check the real name of the Membership's application name by going to your SQL Server, open up the aspnet_Applications table and view the LoweredApplicationName column. ... if you have a connectionString you are using for your ... The connection string specifies a local Sql Server Express instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Global variables and DTS Packages
    ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... > different servers whenever a batch is paid-off. ... > VB6 application to DTS package which will create a SQL ...
    (microsoft.public.sqlserver.dts)
  • Re: Visual Studio .NET 2005 WebParts cant connect to SQL Server 2
    ... in the Sql Server 2005 Express instance ... Boolean& failoverDemandDone, String host, String failoverPartner, ... user, String password, Boolean trusted, String connectionString) +68 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ADO controls
    ... >> You need at least three pieces of information to create the connection ... >> string - the name of the SQL Server, the name of the instance, and the ... >> assume that SQL Server is on the current machine. ...
    (microsoft.public.vb.database.ado)