Home > Query, SQL > BISQL # 65 – How to Find Column name by Data type in Database ? (Search table fields by data types )

BISQL # 65 – How to Find Column name by Data type in Database ? (Search table fields by data types )

Hi friends ,

I have already provided various types of search for Data Base such as

As I thought I should able to search column by data type

For example can I have list of all column which having Data type int or money .

Following SQL command is used to find column from databases based on data type

Script :

SELECT OBJECT_NAME(c.OBJECT_ID) 'Table Name', c.name 'Column Name'
FROM  sys.columns AS c
JOIN  sys.types AS t 
ON    c.user_type_id=t.user_type_id
WHERE t.name = 'money' --We have to give our required Data Type here
ORDER BY c.OBJECT_ID

Output :

image

So in above output we got the all column name having data type as money also we have table name for more information

Sooner I am providing some search based on Primary key and Foreign key relationship if any one is working on large database its really going to be useful !!

Hope this explanation is useful for you !!

Thanks for visiting my blog !!

If you really like reading my blog and understood at lest few thing then please don’t forget to subscribe my blog .

If you wan daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog

Where todays links are

Link Resource Website

Advertisements
Categories: Query, SQL
  1. ElbiyaaliM
    October 9, 2015 at 6:09 pm

    how to eliminate repetitions regarding the tables’ names

  1. No trackbacks yet.

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: