RSS

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
     o.name as tableName,
    c.name as ColumnName,
    t.Name as ColumnType,
    o.type as ObjectType,
    u.name as SchemaName
from syscolumns c
inner join sysobjects o
    on o.id=c.id
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%'

Advertisements
 
Leave a comment

Posted by on April 12, 2011 in SQL

 

Tags:

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: