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
 Type mismatch error

Author  Topic 

funkyspirit
Starting Member

9 Posts

Posted - 2011-12-14 : 08:36:18
Hi there,

If you query an sql database for the information in a table field, what is usually the type of the data that is returned?

I hope this makes sense.

Thank you.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-14 : 08:47:38
The data type of the data return is the data type of the column. It will not be changed. Unless you use cast() or convert() to change it in the SELECT statement


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-14 : 09:16:37
the data type of column can be obtained from INFORMATION_SCHEMA.COLUMNS catalog view

SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME =<required column name> AND TABLE_NAME = <table name>


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -