Find Column name with Datatype of a table in SQL server

Below query will show all column list with their datatype of a table in SQL Server

select col.name as 'ColumName',typ.name as 'DataType' from sys.columns col left join sys.types typ
on col.system_type_id=typ.system_type_id  where object_id=object_id('Your Table Name')


Replace "Your Table Name" with your Table Name

It will show result like this..

ColumName DataType
col1 int
col2 varchar
col3 varchar
col4 int
col5 bit
col6 bit



Ebook Download
View all
Learn
View all