Back
Is there a SQL statement that can return the type of a column in a table?
For SQL Server, try using this code:
SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNSWHERE TABLE_NAME = 'yourTableName' AND COLUMN_NAME = 'yourColumnName'
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = 'yourTableName' AND
COLUMN_NAME = 'yourColumnName'
31k questions
32.8k answers
501 comments
693 users