alistairphillips.com

I’m : a web and mobile developer based in the Manning Valley, Australia.


Microsoft SQL Server

A few useful tidbits

--- Table description
SELECT * FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'tableNameHere', NULL, NULL)

-- Field descriptions
SELECT * FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'tableNameHere', 'column', NULL) WHERE name = 'MS_Description'

-- If you need to search for tables containing a specific field:
SELECT object_name(id), name
  FROM syscolumns
 WHERE name LIKE '%field%'
   AND id IN (SELECT id FROM sysobjects WHERE type ='u')