慕莱坞森
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[SP_ADInsert]') AND type='P')
DROP PROCEDURE [dbo].[SP_ADInsert]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[SP_ADInsert]
(
@CustomerName nvarchar(200),
@LoginID nvarchar(50),
@AddTime datetime,
@CurState smallint,
@ReTurnValue int OUTPUT
)
AS
BEGIN TRAN
Insert
[AD]
(
[CustomerName],
[LoginID],
[AddTime],
[CurState]
)
Values
(
@CustomerName,
@LoginID,
@AddTime,
@CurState
) set @ReTurnValue=SCOPE_IDENTITY()
IF @@ERROR!=0
BEGIN set @ReTurnValue=-1
ROLLBACK
END
ELSE
BEGIN
COMMIT
END
GO