Constraints can be specified for typed or untyped xml data type columns.
However, you cannot use the XML data type methods when you specify constraints.
xml data type not supported for the following column and table constraints:
PRIMARY KEY/ FOREIGN KEY
UNIQUE
COLLATE
RULE
An alternative to using constraints is to create a wrapper, user-defined
function to wrap the xml data type method and specify user-defined function in
the check constraint as shown in the following example
CREATE FUNCTION myfunc1(@var xml) returns bit
AS BEGIN
RETURN @var.exist('/ProductDescription/@ProductID')
END
GO