Am I overlooking something really obvious...I hope? The UPDATE gives the following error. But I can change the statement to a SELECT and it works fine
(DailyID column is data type int).(4 row(s) affected)Server: Msg 245, Level 16, State 1, Line 27Syntax error converting the varchar value '95,96,97,98,' to a column of data type int.DECLARE @pDailyID varchar(500)SET @pDailyID = '95,96,97,98' --test valuesUPDATE dbo.DailySET Reviewed = @pReviewed, ReviewedBy = @pReviewedBy, DateReviewed = @pDateReviewed--WHERE DailyID IN (SELECT IntValue FROM dbo.CsvToInt(@pDailyID))WHERE DailyID IN (95,96,97,98)
BTW, the commented line uses a CSV parsing UDF but I get the same error. Error is always on the last pass. In other words, if I decrease the string by one number then 3 rows will be inserted. Cameron