Binds a user message to a referential integrity constraint or check constraint.
sp_bindmsg constrname, msgid
sp_bindmsg positive_balance, 20100
sp_bindmsg binds a user message to an integrity constraint by adding the message number to the constraint row in the sysconstraints table.
Only one message can be bound to a constraint. To change the message for a constraint, just bind a new message. The new message number replaces the old message number in the sysconstraints table.
You cannot bind a message to a unique constraint because a unique constraint does not have a constraint row in sysconstraints (a unique constraint is a unique index).
Use the sp_addmessage procedure to insert user messages into the sysusermessages table.
The sp_getmessage procedure retrieves message text from the sysusermessages table.
sp_help tablename displays all constraint names declared on tablename.
See also alter table, create table in Reference Manual: Commands.
You must be the constraint owner to execute sp_bindmsg. Permission checks do not differ based on the granular permissions settings.
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 7 |
Audit option | bind |
Command or access audited | sp_bindmsg |
Information in extrainfo |
|
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|