Wednesday, March 16, 2016

Identify all SQL Server tables that have XML columns

Managing the XML data type, and manipulating XML data in SQL Server is a tremendous topic.  Or a 'whole new can of worms', per se.  But, it can be done.  This post only skims the surface, but it's very simple method of listing all of the tables and columns in your database that are the XML data type.  Super easy, but very helpful as well.  I used it myself just today.

   USE yourDBname;
   SELECT
         TABLE_CATALOG [Database],
         TABLE_NAME [Table],
         COLUMN_NAME [Column]
   FROM
         INFORMATION_SCHEMA.COLUMNS
   WHERE
         DATA_TYPE = 'XML'


Your results:













As I said, it only skims the surface, but it's super quick, super easy, and it works.  I'll try to get back here soon with some more involved details on the XML datatypes and manipulations with SQL Server.  Until then....

More details regarding the SQL Server XML data type:

No comments:

Post a Comment