I'd like to create a custom warning for every change in table design (like the warning about tables affected). I created a trigger on database for ALTER_TABLE but i've no idea how to show an alert for that. Any idea?
Asked
Active
Viewed 122 times
1 Answers
0
-- New message:
EXEC Sp_Addmessage 500021,
10,
'Custom message';
GO
RAISERROR(500021, 10, 1);
-- Replacement of Message:
EXEC Sp_Addmessage 500021,
10,
'Custom message... ',
@Lang = 'us_english',
@With_log = 'false',
@Replace = 'replace';
GO
RAISERROR(500021, 10, 1);
-- Altering the message:
EXEC Sp_Altermessage 500021,
@Parameter = 'with_log',
@Parameter_value = 'true';
-- Dropping the message:
EXEC Sp_Dropmessage 500021;

SQL_M
- 2,455
- 2
- 16
- 30
-
-
-
As i wrote i want a message like the warning you have when you try to alter a table and this alter affects more tables. It's an alert that appears even in the design of SSMS. I want something like that – SimoneG Oct 31 '17 at 15:50