The following code in my insert trigger returns the values all in a single row . If users are entering 1-10 rows at a time then that is fine but if they are entering 100s then the raiserror output becomes too long to read . What is the best solution for this please ?
TRIGGER CODE :
DECLARE @level_name nvarchar(MAX) =
(
SELECT concat ([S_ID],'-', [l_NAME], '-')
+ ' '
FROM inserted ic
where not EXISTS (SELECT 1 FROM [dbo].[LEVELS] c
WHERE ic.[geo]=c.[GEO] and c.level_name=ic.[l_NAME]
)
FOR XML PATH('')
);
IF @level_name IS NOT NULL
BEGIN
RAISERROR('level name not found: %s', 16, 1, @level_name) with log;
END;
OUTPUT :
100-A2001 101-A2001 102-A2001 .......
No comments:
Post a Comment