Re: Batches
From: Andrew J. Kelly (sqlmvpnooospam_at_shadhawk.com)
Date: 11/24/04
- Next message: Mal .mullerjannie_at_hotmail.com>: "Re: Query about the LIKE statement"
- Previous message: Dan Guzman: "Re: lookup query"
- In reply to: Mike: "Re: Batches"
- Next in thread: Mike: "Re: Batches"
- Reply: Mike: "Re: Batches"
- Messages sorted by: [ date ] [ thread ]
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 >>> >> >> > >
- Next message: Mal .mullerjannie_at_hotmail.com>: "Re: Query about the LIKE statement"
- Previous message: Dan Guzman: "Re: lookup query"
- In reply to: Mike: "Re: Batches"
- Next in thread: Mike: "Re: Batches"
- Reply: Mike: "Re: Batches"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|