dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
May 17, 2019

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Get All Columns in All Tables of a Specific Data Type

We can get all columns in all tables of a specific data type. The example below gets all INT columns in the entire database

SELECT OBJECT_NAME(sys.columns.OBJECT_ID) as TableName, sys.columns.name as ColumnName  
  
FROM sys.columns  
  
JOIN sys.types ON sys.columns.user_type_id = sys.types.user_type_id  
  
WHERE sys.types.name = 'INT'
Hannes du Preez
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Thanks for your registration, follow us on our social networks to keep up-to-date