Hi,
When try to execute below statement, i am getting timeout error some times and this is written to execute as a script, so i can not determine at which point it gets timed out.
Declare @ID BIGINT;
Select @ID = Max(PMTDID) from TBLT_PaymentModeTransferDetail with (NOLOCK)
if @Id IS NOT NULL
BEGIN
DBCC CHECKIDENT(TBLT_PaymentModeTransferDetail, RESEED, @ID)
END
ELSE If @ID IS NULL AND Ident_Current('TBLT_PaymentModeTransferDetail') <> (Select IDENT_SEED(TABLE_NAME) AS Seed from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TBLT_PaymentModeTransferDetail')
BEGIN
Set @ID = 1404
DBCC CHECKIDENT(TBLT_PaymentModeTransferDetail, RESEED, @ID)
END
ELSE IF 1404 IS NOT NULL AND Ident_Current('TBLT_PaymentModeTransferDetail') = (Select IDENT_SEED(TABLE_NAME) AS Seed from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TBLT_PaymentModeTransferDetail')
BEGIN
Select @ID = (IDENT_SEED(TABLE_NAME) -1) from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TBLT_PaymentModeTransferDetail'
DBCC CHECKIDENT(TBLT_PaymentModeTransferDetail, RESEED, @ID)
END
Thanks,
Rajnikant