Click here to Skip to main content
15,944,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guyz,

Just wanted to know that how to get the data type of a for the following Query.

SELECT '345/575'

There is no table its just the value that i have selected.. FOR TEST..

SELECT '123' AS t, 123 AS t2
into #tmp 
SELECT TYPE_NAME(c.system_type_id)  AS type FROM tempdb.sys.[columns] c WHERE c.[object_id] = object_id('tempdb.dbo.#tmp')

you can do it like this
Share this answer
Adarsh chauhan 7-Nov-13 0:18am    
Nice.. +5
xibit89 7-Nov-13 0:32am    
Thanks. :)
try this

select DATA_TYPE from INFORMATION_SCHEMA.COLUMNS IC where TABLE_NAME = 'Your TableName' and COLUMN_NAME = 'your column name'

it will give you data type of a column..
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900