ALTER PROCEDURE [dbo].[sp_Ignition_UPDATE] --点火单UPDATE存储过程
@N_IgnitionID numeric(9, 0),
@N_CreateIgnitionmanID numeric(9, 0),
@N_UserID numeric(9, 0),
@D_CreateDate datetime,
@D_BookingDate datetime,
@VC_Re varchar(400),
@Send int,
@N_ExaminManID numeric(9, 0)=NULL,
@D_ExaminDate datetime=NULL,
@N_AppointManID decimal(9, 0)=NULL,
@D_AppointDate datetime=NULL,
@N_IgnitionManID numeric(9, 0)=NULL,
@D_CompleteDate datetime=NULL,
@N_WriteMANID numeric(9, 0)=NULL,
@D_WriteDate datetime=NULL,
@VC_State varchar(20)=NULL
AS
BEGIN
BEGIN TRAN
Update TBL_Ignition
SET
N_CreateIgnitionmanID=@N_CreateIgnitionmanID,
N_AppointManID=@N_AppointManID,
N_ExaminManID=@N_ExaminManID,
N_UserID=@N_UserID,
N_WriteMANID=@N_WriteMANID,
N_IgnitionManID=@N_IgnitionManID,
D_BookingDate=@D_BookingDate,
D_ExaminDate=@D_ExaminDate,
D_AppointDate=@D_AppointDate,
VC_State=@VC_State,
D_CompleteDate=@D_CompleteDate,
D_WriteDate=@D_WriteDate,
D_CreateDate=@D_CreateDate,
VC_Re=@VC_Re
Where (N_IgnitionID =@N_IgnitionID )
print @@error
print @@rowcount
print @Send
IF(@@ERROR=0)
BEGIN
IF(@@ROWCOUNT=0)
BEGIN
UPDATE TBL_User SET I_State=@Send where N_UserID=@N_UserID
IF(@@ERROR=0)
BEGIN
IF(@@ROWCOUNT=0)
BEGIN
COMMIT TRAN
END
ELSE
BEGIN
ROLLBACK TRAN
END
END
ELSE
BEGIN
ROLLBACK TRAN
END
END
ELSE
BEGIN
ROLLBACK TRAN
END
END
ELSE
BEGIN
ROLLBACK TRAN
END
END为什么@@rowcount老是等于0
@N_IgnitionID numeric(9, 0),
@N_CreateIgnitionmanID numeric(9, 0),
@N_UserID numeric(9, 0),
@D_CreateDate datetime,
@D_BookingDate datetime,
@VC_Re varchar(400),
@Send int,
@N_ExaminManID numeric(9, 0)=NULL,
@D_ExaminDate datetime=NULL,
@N_AppointManID decimal(9, 0)=NULL,
@D_AppointDate datetime=NULL,
@N_IgnitionManID numeric(9, 0)=NULL,
@D_CompleteDate datetime=NULL,
@N_WriteMANID numeric(9, 0)=NULL,
@D_WriteDate datetime=NULL,
@VC_State varchar(20)=NULL
AS
BEGIN
BEGIN TRAN
Update TBL_Ignition
SET
N_CreateIgnitionmanID=@N_CreateIgnitionmanID,
N_AppointManID=@N_AppointManID,
N_ExaminManID=@N_ExaminManID,
N_UserID=@N_UserID,
N_WriteMANID=@N_WriteMANID,
N_IgnitionManID=@N_IgnitionManID,
D_BookingDate=@D_BookingDate,
D_ExaminDate=@D_ExaminDate,
D_AppointDate=@D_AppointDate,
VC_State=@VC_State,
D_CompleteDate=@D_CompleteDate,
D_WriteDate=@D_WriteDate,
D_CreateDate=@D_CreateDate,
VC_Re=@VC_Re
Where (N_IgnitionID =@N_IgnitionID )
print @@error
print @@rowcount
print @Send
IF(@@ERROR=0)
BEGIN
IF(@@ROWCOUNT=0)
BEGIN
UPDATE TBL_User SET I_State=@Send where N_UserID=@N_UserID
IF(@@ERROR=0)
BEGIN
IF(@@ROWCOUNT=0)
BEGIN
COMMIT TRAN
END
ELSE
BEGIN
ROLLBACK TRAN
END
END
ELSE
BEGIN
ROLLBACK TRAN
END
END
ELSE
BEGIN
ROLLBACK TRAN
END
END
ELSE
BEGIN
ROLLBACK TRAN
END
END为什么@@rowcount老是等于0
你要这么写
declare @error int,@rowcount int
....sql语句
select @error=@@error,@rowcount=@@rowcount
然后用@error和@rowcount判断