Re: Batches

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

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


Date: Wed, 24 Nov 2004 18:55:28 -0500

Life is always a learning experience<g>...

-- 
Andrew J. Kelly  SQL MVP
"Mike" <noone@hotmail.com> wrote in message 
news:uW6a%23rn0EHA.480@TK2MSFTNGP10.phx.gbl...
> Yes, you are right, the questions was very badly expressed.  I'll try 
> harder next time!
>
> Mike
>
>
> "Andrew J. Kelly" <sqlmvpnooospam@shadhawk.com> wrote in message 
> news:ezlrX9i0EHA.3292@TK2MSFTNGP10.phx.gbl...
>> 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: HELP PLEASE ~ ???
    ... You mentioned that it went ahead and added a SQL ... SQL Server 2000 database for all my data. ... find the connectionString in the newly recreated SQLExpress database. ... The connection string specifies a local Sql Server Express instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Web Part and Access database
    ... I dont know if it is possible to connect to access,but you can download SQL ... Server Error in '/Webparts' Application. ... The connection string specifies a local Sql Server Express instance ... String user, String password, Boolean trusted, String connectionString) ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: SQL 2000 and MSDE/Express/Compact edition..
    ... What is does is downloads .Net Framework and SQL Server Express if they are not installed and then configures SQL Server as a subscriber. ... string DotNetFramework2Location = ... LogMe("Creation of Replication Account failed."); ...
    (microsoft.public.sqlserver.replication)
  • Using ASP.NET to login to SQL Server 2005 Database
    ... Windows Server 2003 Enterprise Edition SP2 ... When I click the login box, I want asp.net to check the SQL ... useFailoverPartner, Boolean& failoverDemandDone, String host, String ...
    (comp.databases.ms-sqlserver)
  • Re: Executing SQL DTS Package from Access
    ... Does the DTS package run correctly when you run it manually through SQL ... Microsoft OLE DB Provider for SQL Server ... Dim oPKG As DTS.Package, oStep As DTS.step ... Dim sServer As String, sUsername As String, sPassword As String ...
    (microsoft.public.access.formscoding)