All data types used in database

— Return all data types used in the user tables of a database.

select ty.name as DataType, count(*) as NumberOfUses
from sys.tables as t
join sys.columns as c
on c.[object_id] = t.[object_id]
join sys.types as ty
on ty.user_type_id = c.user_type_id
where t.is_ms_shipped = 0
group by ty.name
order by ty.name

go

Advertisements

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: