PC Review


Reply
 
 
=?Utf-8?B?dmVlcmEgc2VraGFyIGtvdGE=?=
Guest
Posts: n/a
 
      1st Aug 2005
Hi,

I need to insert nearly more than 6000 records in a single shot.
For that I need to get the data from tree view (windows app) control,
Im reading through recursive mannner to get parent & childs and im forming
an xml file then sending to backend.

here to compose the xml file from tree view control it is taking 25 secs
time and
at back end I returned and Stored procedure for bulk insert.

Create PROC insertversion
(
@VersionData ntext
,@Update bit
)
AS



DECLARE @hDoc int
EXEC sp_xml_preparedocument @hDoc OUTPUT,@VersionData

IF @Update = 1
BEGIN
INSERT INTO Version_Map (version_id, question_id, parent_question_id,
disp_sequence_nbr, created_by, created_date, updated_by, updated_date)
SELECT * FROM OPENXML(@hDoc, 'ROOT/QUESTIONS/QUESTION',1)
WITH ( VERSION_ID int , QUESTION_ID INT, PARENT_QUESTION_ID int, SEQNO
int, created_by varchar(20), created_date datetime, updated_by varchar(20),
updated_date datetime) XMLVersion
END
ELSE
BEGIN
INSERT INTO Version_Map (version_id, question_id, parent_question_id,
disp_sequence_nbr, created_by, created_date)
SELECT * FROM OPENXML(@hDoc, 'ROOT/QUESTIONS/QUESTION',1)
WITH ( VERSION_ID int , QUESTION_ID INT, PARENT_QUESTION_ID int, SEQNO
int, created_by varchar(20), created_date datetime) XMLVersion

END


EXEC sp_xml_removedocument @hDoc



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Here Im using the OpenXml method... for bulk insert this is taking 50 secs..

Total insert opration it is taking 84 secs to do this operation...

but Im looking a solution to this operation with in 10 secs..

plz help me ....
thanks ....

 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      1st Aug 2005
I would check out the Bulk Copy functionality in TSQL. I expect you'll be
able to eliminate the need to transform into XML if you do.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"veera sekhar kota" <(E-Mail Removed)> wrote in message
news:28018DA2-662F-4F32-B92E-(E-Mail Removed)...
> Hi,
>
> I need to insert nearly more than 6000 records in a single shot.
> For that I need to get the data from tree view (windows app) control,
> Im reading through recursive mannner to get parent & childs and im forming
> an xml file then sending to backend.
>
> here to compose the xml file from tree view control it is taking 25 secs
> time and
> at back end I returned and Stored procedure for bulk insert.
>
> Create PROC insertversion
> (
> @VersionData ntext
> ,@Update bit
> )
> AS
>
>
>
> DECLARE @hDoc int
> EXEC sp_xml_preparedocument @hDoc OUTPUT,@VersionData
>
> IF @Update = 1
> BEGIN
> INSERT INTO Version_Map (version_id, question_id, parent_question_id,
> disp_sequence_nbr, created_by, created_date, updated_by, updated_date)
> SELECT * FROM OPENXML(@hDoc, 'ROOT/QUESTIONS/QUESTION',1)
> WITH ( VERSION_ID int , QUESTION_ID INT, PARENT_QUESTION_ID int, SEQNO
> int, created_by varchar(20), created_date datetime, updated_by
> varchar(20),
> updated_date datetime) XMLVersion
> END
> ELSE
> BEGIN
> INSERT INTO Version_Map (version_id, question_id, parent_question_id,
> disp_sequence_nbr, created_by, created_date)
> SELECT * FROM OPENXML(@hDoc, 'ROOT/QUESTIONS/QUESTION',1)
> WITH ( VERSION_ID int , QUESTION_ID INT, PARENT_QUESTION_ID int, SEQNO
> int, created_by varchar(20), created_date datetime) XMLVersion
>
> END
>
>
> EXEC sp_xml_removedocument @hDoc
>
>
>
> GO
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS ON
> GO
>
> Here Im using the OpenXml method... for bulk insert this is taking 50
> secs..
>
> Total insert opration it is taking 84 secs to do this operation...
>
> but Im looking a solution to this operation with in 10 secs..
>
> plz help me ....
> thanks ....
>



 
Reply With Quote
 
rbutch@coair.com
Guest
Posts: n/a
 
      1st Aug 2005
I agree w/ Bill.
that bcp function as well as the BULK INSERT does some amazing things.
i have a db table with approx 1.6million rows and bcp takes care of the whole table in less than 1.5 minutes. another table has 27,159 rows and thats 1/3 of a second to execute.
thanks
rik



**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk insert into DB using ADO.net 1.1 utanka Microsoft ADO .NET 1 11th May 2006 08:37 PM
RE: Bulk insert? =?Utf-8?B?RWx0b24gVw==?= Microsoft ADO .NET 0 26th Mar 2006 11:50 PM
Opinions wanted: Bulk Insert vs Record Insert =?Utf-8?B?RGFsZSBGeWU=?= Microsoft Access Form Coding 2 8th Mar 2006 03:26 PM
BULK INSERT and VB.Net Mythran Microsoft ADO .NET 0 5th Apr 2005 04:41 PM
fastest way to insert data (no bulk insert, no dts) Hakan Eren Microsoft ADO .NET 3 18th Sep 2003 05:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:59 AM.