noob
noob

Reputation: 3811

How to see the data types of all columns in SQL Sever Management System

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

Answers (2)

Mukesh Arora
Mukesh Arora

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

  1. Expand the Tables
  2. Expand the desired table
  3. Expand the columns

enter image description here

Upvotes: 2

Yogesh Sharma
Yogesh Sharma

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

Related Questions