Hi everybody,
Could someone help me ???
I don't know how to get a return value from a stored procedure using ASP. Could someone tell me how to do that?
Here's my stored procedure :
CREATE PROCEDURE dbo.sp_getNewAgrementNumber(@category nvarchar(20), @newRecord bit, @idRecord int) AS
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET LOCK_TIMEOUT 3000
BEGIN TRAN
DECLARE
@newId bigint,
@oldAgrementNum bigint,
@newAgrementNum nvarchar(20)
If @category = 'R'
BEGIN
SELECT @oldAgrementNum=idAgrement FROM numberTable WHERE typeAgrement = 'R'
SET @newId = @oldAgrementNum
SET @newAgrementNum = @category + CONVERT(nvarchar(20), @newId)
If @newRecord = 0
UPDATE reparateurs SET NUMERO = @newAgrementNum WHERE ID = @idRecord
else if @newRecord = 1
INSERT INTO reparateurs (NUMERO) VALUES(@newAgrementNum)
SET @newId = @newId + 1
UPDATE numberTable SET idAgrement = @newId WHERE typeAgrement = 'R'
END
else
BEGIN
SELECT @oldAgrementNum=idAgrement FROM numberTable WHERE typeAgrement = 'L'
SET @newId = @oldAgrementNum
SET @newAgrementNum = @category + CONVERT(nvarchar(20), @newId)
If @newRecord = 0
UPDATE reparateurs SET NUMERO = @newAgrementNum WHERE ID = @idRecord
else if @newRecord = 1
INSERT INTO reparateurs (NUMERO) VALUES(@newAgrementNum)
SET @newId = @newId + 1
UPDATE numberTable SET idAgrement = @newId WHERE typeAgrement = 'L'
END
SELECT newAgrement = @newAgrementNum
COMMIT TRAN
GO
Thank you
Could someone help me ???
I don't know how to get a return value from a stored procedure using ASP. Could someone tell me how to do that?
Here's my stored procedure :
CREATE PROCEDURE dbo.sp_getNewAgrementNumber(@category nvarchar(20), @newRecord bit, @idRecord int) AS
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET LOCK_TIMEOUT 3000
BEGIN TRAN
DECLARE
@newId bigint,
@oldAgrementNum bigint,
@newAgrementNum nvarchar(20)
If @category = 'R'
BEGIN
SELECT @oldAgrementNum=idAgrement FROM numberTable WHERE typeAgrement = 'R'
SET @newId = @oldAgrementNum
SET @newAgrementNum = @category + CONVERT(nvarchar(20), @newId)
If @newRecord = 0
UPDATE reparateurs SET NUMERO = @newAgrementNum WHERE ID = @idRecord
else if @newRecord = 1
INSERT INTO reparateurs (NUMERO) VALUES(@newAgrementNum)
SET @newId = @newId + 1
UPDATE numberTable SET idAgrement = @newId WHERE typeAgrement = 'R'
END
else
BEGIN
SELECT @oldAgrementNum=idAgrement FROM numberTable WHERE typeAgrement = 'L'
SET @newId = @oldAgrementNum
SET @newAgrementNum = @category + CONVERT(nvarchar(20), @newId)
If @newRecord = 0
UPDATE reparateurs SET NUMERO = @newAgrementNum WHERE ID = @idRecord
else if @newRecord = 1
INSERT INTO reparateurs (NUMERO) VALUES(@newAgrementNum)
SET @newId = @newId + 1
UPDATE numberTable SET idAgrement = @newId WHERE typeAgrement = 'L'
END
SELECT newAgrement = @newAgrementNum
COMMIT TRAN
GO
Thank you