Get all columns of a certain type from database

12 Apr

How do you get all the tables and columns in your database where the type is like money?

select as tableName, as ColumnName,
    t.Name as ColumnType,
    o.type as ObjectType, as SchemaName
from syscolumns c
inner join sysobjects o
inner join sysusers u
    on u.uid= o.uid
inner join sys.types t
    on t.system_type_id = c.xtype
where t.Name like '%money%'

Leave a comment

Posted by on April 12, 2011 in SQL



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: