Find Column Name in SQL Server

Our mind always remembers what we frequently use and it forgets what we occasionally use. In my case I couldn't remember more than 10 columns.

Let’s see how we can find out the column names by searching with some of its characters.

To find the column names as well as table name, table schema, data type, position of the column, is_nullable,

Character length of the column, collation name, etc.,

  1. SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%Product%'  
You can also use the below query,
  1. SELECT * FROM SYS.COLUMNS C, SYS.TABLES T WHERE C.OBJECT_ID = T.OBJECT_ID AND C.NAME LIKE '%PRODUCT%'  

 

Ebook Download
View all
Learn
View all