Reputation: 3811
I could not find answer to this question, despite it being very basic. How do I know whats the data type of all columns in SQL Server management System?
Col1 Col2 Col3 and so on
I wish to know the datatypes of each column in say Table1
where Table1
is the name of my table .
Upvotes: 0
Views: 688
Reputation: 1813
There are couple of options to see the data types of columns of the desired table -
Option 1
sp_help <tableName>
e.g. sp_help Table1
Option 2
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Table1'
Option 3
Upvotes: 2
Reputation: 50163
There are many several way to do this, one of them is to use schema
:
select *
from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME = 'Table1' or
COLUMN_Name = 'col1';
Upvotes: 1