0

This SP is working well. But when recordcount in dbo.PTSGELEN is over 1000000 approx. it comes timeout error.

ALTER PROCEDURE [dbo].[PTS2Tabloya] 

   @KOLETIK nvarchar(40),
   @SIL tinyint ,
   @EKLENEN int OUT

AS
BEGIN

   SET NOCOUNT ON;
   set @EKLENEN = 0
IF @SIL=0 AND LEN(@KOLETIK)=20
begin
INSERT INTO dbo.URUNGIR (GTIN,SN,XD,BN,CLABEL,SLABEL)
SELECT GTIN,SN,XD,BN,CLABEL,SLABEL FROM dbo.PTSGELEN WHERE 
    (CLABEL = @KOLETIK OR SLABEL = @KOLETIK); 
set @EKLENEN = @@Rowcount ;
END; 

IF @SIL=1 AND LEN(@KOLETIK)=20
BEGIN
DELETE FROM dbo.URUNGIR WHERE (CLABEL = @KOLETIK OR SLABEL = @KOLETIK) ;
set @EKLENEN = @@Rowcount ;

END;


END

Edited by pritaeas: Moved.

2
Contributors
1
Reply
11
Views
4 Years
Discussion Span
Last Post by BitBlt
0

Not much to go on here. Which statement times out? Are there indexes on your tables to help with the selection? What is the timeout value set to on the connection? What is your server memory? Are there governor policies set? Does the insert cause an autogrow condition on the database? How's your disk space? Full recovery model? Any other transactions colliding? User load on the server?

These are just a few possibilities to help analyze your situation. Best of luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.