Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 very slowly insertion procedure

Author  Topic 

raniait
Starting Member

14 Posts

Posted - 2002-11-27 : 01:25:26
Hi
I am trying to use stored procedure during my insertion (Not bulk one) and updating but it works very slowly it takes may be 10 times the normal Sql,ADO execution
Knowing that i am using text field in my table
i was searching for this problem i found this article

http://support.microsoft.com/default.aspx?scid=KB;en-us;304365&


Can u help me because i am confused

The following is my procedure
CREATE PROC sp_Insert (@nParentID Int, @serialID nvarChar(200),@Title nvarChar(100),@Author nvarChar(100),@Link nvarChar(400),@Keyword nvarChar(100),@IsLeaf bit ,@Date1 datetime,@strFileText text)

AS



IF EXISTS (SELECT ID FROM Article

WHERE Link = @Link)

Update Article Set SerialID=@serialID,Title=@Title,Author=@Author,Link=@Link,Keywords=@Keyword,Doc_Text=@strFileText,Doc_Date=@Date1,IsLeaf=@IsLeaf where Link=@Link

else

INSERT Article (ParentID,SerialID,Title,Author,Link,keywords,IsLeaf,Doc_Date,Doc_Text)

VALUES (@nParentID, @serialID ,@Title,@Author,@Link,@Keyword,@IsLeaf,@Date1 ,@strFileText)

GO


sherrer

64 Posts

Posted - 2002-11-27 : 16:39:59
First it is probably more efficient to not check for the existance of the row, and just delete it instead of updating. Then you can insert your data. Of course you would want to wrap this in a transaction and check for errors after your delete and insert, so that you won't lose any data.

Are there any clustered indexes in your table?

Are you doing single transactions or is this procedure being called in a loop?




Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2002-11-28 : 15:21:48
Try using WRITETEXT and UPDATETEXT instead.

Sarah Berger MCSD
Go to Top of Page

raniait
Starting Member

14 Posts

Posted - 2002-12-11 : 08:54:22
yes i am using the procedure in a loop
as i am inserting the content of articles so i am forced to insert one by one not batch insert as the content is so large

Go to Top of Page
   

- Advertisement -