Checking for Constraints in SQL

I had to make some updates in one of to a clients Azure SQL databases, that required me to drop and recreate a table that had a foreign key relationship.  To do this I needed to drop and recreate the FK relationship on a table and I used this script to find all constraints in the the database.


OpenXML: XML parsing error: Reference to undeclared namespace prefix:

I ran into a small issue using an XML document type in SQL 2005 from BizTalk 2006 R2 and it turn our to be a namespace pass in from the sp_xml_preparedocument statement in my stored procedure.

You need to set it up as follows:
EXECUTE sp_xml_preparedocument @idoc OUTPUT, @xmlMessage, ‘<root xmlns:ns1=”http://namespacename” />’

The ‘<root xmlns:ns1=”http://namespacename” />’ being the most important part as this defines the namespace from the first part of your message.

Then your OPENXML call can be set up using the namespace – i.e /ns1:<node> etc.