Check the datatype of a field | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Check the datatype of a field

Hi Friends, Is there any way ( either query) to find out the datatype of a field in sql Database. I need to use it in a VB program. I need to check the Datatype of the field and do some manupulation to that field. Looking forward to your answers Thanks in advance Surjit
sp_columns —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
Ich unterstuetze PASS Deutschland e.V. http://www.sqlpass.de)
quote:Originally posted by FrankKalis sp_columns —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
Ich unterstuetze PASS Deutschland e.V. http://www.sqlpass.de)

Thanks Frank for your quick reply. The stored procedure will show all the fields. Is there any process where I can check for single field where I can use "where fieldname =fld_name. Thanks
Surjit
Oh, I see.
What about
USE Northwind
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = ‘Orders’
AND COLUMN_NAME = ‘OrderID’

Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
Ich unterstuetze PASS Deutschland e.V. http://www.sqlpass.de)
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by FrankKalis</i><br /><br />Oh, I see.<br />What about<br /><pre id="code"><font face="courier" size="2" id="code"><br />USE Northwind<br />SELECT DATA_TYPE<br /> FROM INFORMATION_SCHEMA.COLUMNS<br /> WHERE TABLE_NAME = ‘Orders'<br /> AND COLUMN_NAME = ‘OrderID'<br /></font id="code"></pre id="code"><br /><br />–<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />Heute schon gebloggt?<a target="_blank" href=http://www.insidesql.de/blogs>http://www.insidesql.de/blogs</a><br />Ich unterstuetze PASS Deutschland e.V. <a target="_blank" href=http://www.sqlpass.de>http://www.sqlpass.de</a>)<br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br /><br />Thanks Frank [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]
]]>