This procedure will update data in column but ended up with this message
Msg 4145, Level 15, State 1, Procedure updatetings , Line 26 [Batch Start Line 4] An expression of non-boolean type specified in a context where a condition is expected, near 'BEGIN'.
This bold words is the problem come from
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE updatetings
@i_id VARCHAR (50),
@i_proccess VARCHAR (10),
@i_line VARCHAR (50),
@i_group VARCHAR (10),
@i_date DATETIME
WITH EXEC AS CALLER
AS
BEGIN
SET NOCOUNT ON
SET NUMERIC_ROUNDABORT OFF
SET ANSI_NULLS , ANSI_PADDING , ANSI_WARNINGS , ARITHABORT ,
CONCAT_NULL_YIELDS_NULL , QUOTED_IDENTIFIER ON
-- PROBLEM HERE
IF @i_proccess = 'xxx'
BEGIN
UPDATE database SET
date = @i_date,line = @i_line,Group = @i_group
WHERE id = @i_id
END
END
EXEC updatetings '8','xx','xx','xx','2022-02-23 08:25:43.780'
1条答案
按热度按时间c2e8gylq1#
some answer is needed for when the IF does not have the result you expect
BEGIN UPDATE database SET date = @i_date,line = @i_line,Group = @i_group WHERE id = @i_id END ELSE BEGIN PRINT 'Nothing to update' END