Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 is there way to return data type of a column.

Author  Topic 

NagaVardhanReddy
Starting Member

4 Posts

Posted - 2012-02-10 : 02:29:51
Hi Friends,

Is there any query for returning column data type.

For example: rollNo INTEGER, Name TEXT, Marks1 INTEGER, MARKS2 INTEGER.


But when i am processing the table, if i don't know the data types of the columns in the table, how to get data type of each column in the table.

I tried with PRAGMA table_info(tabl_name); But i am getting all info related to table,
ex: Column NUmber, Column Name, Data Type, values...

But i want only data type.

Can anybody help me how to retrieve only data type of a column.


Regards,

Naga Vardhan Reddy

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-02-10 : 07:01:03

select TABLE_NAME, COLUMN_NAME, DATA_TYPE
from information_schema.columns

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -