ALTER MESSAGE TYPE (Transact-SQL)

Changes the properties of a message type.

Topic link iconTransact-SQL Syntax Conventions

Syntax

ALTER MESSAGE TYPE message_type_name
   VALIDATION =
    {  NONE 
     | EMPTY 
     | WELL_FORMED_XML 
     | VALID_XML WITH SCHEMA COLLECTION schema_collection_name }
[ ; ]

Arguments

  • message_type_name
    The name of the message type to change. Server, database, and schema names cannot be specified.
  • VALIDATION
    Specifies how Service Broker validates the message body for messages of this type.
  • NONE
    No validation is performed. The message body may contain any data, or may be NULL.
  • EMPTY
    The message body must be NULL.
  • WELL_FORMED_XML
    The message body must contain well-formed XML.
  • VALID_XML_WITH_SCHEMA = schema_collection_name
    The message body must contain XML that conforms to a schema in the specified schema collection. The schema_collection_name must be the name of an existing XML schema collection.

Remarks

Changing the validation of a message type does not affect messages that have already been delivered to a queue.

To change the AUTHORIZATION for a message type, use the ALTER AUTHORIZATION statement.

Permissions

Permission for altering a message type defaults to the owner of the message type, members of the db_ddladmin or db_owner fixed database roles, and members of the sysadmin fixed server role.

When the ALTER MESSAGE TYPE statement specifies a schema collection, the user executing the statement must have REFERENCES permission on the schema collection specified.

Examples

The following example changes the message type //Adventure-Works.com/Expenses/SubmitExpense to require that the message body contain a well-formed XML document.

ALTER MESSAGE TYPE
    [//Adventure-Works.com/Expenses/SubmitExpense]
    VALIDATION = WELL_FORMED_XML ;

See Also

Reference

ALTER AUTHORIZATION (Transact-SQL)
CREATE MESSAGE TYPE (Transact-SQL)
DROP MESSAGE TYPE (Transact-SQL)
EVENTDATA (Transact-SQL)

Other Resources

Creating an XML Schema Collection
Message Types

Help and Information

Getting SQL Server 2005 Assistance