get table column datatype in sql server code example
Example 1: get all columns from table sql
SELECT
TABLE_NAME
FROM
INFORMATION_SCHEMA.TABLES
Example 2: sql query to get column data type in sql
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = 'yourTableName' AND
COLUMN_NAME = 'yourColumnName'