Innovative data solutions
Copyright 2013. All rights reserved.
/*
​Purpose: To locate a field within a database
*/
USE <<database name here>>
SELECT
SO.name AS [Table]
,SC.name AS [Column]
,ST.name AS Type
,SC.length
,SC.isnullable
FROM
sys.sysobjects SO
INNER JOIN sys.syscolumns SC ON SO.id = SC.id
INNER JOIN sys.types ST ON ST.system_type_id = SC.xtype
WHERE
SC.name LIKE '%<<field name here>>%'
AND SO.type = 'U' -- Limit to user defined tables
ORDER BY
SO,name
, SC.name