Is there a SQL statement that can return the type of a column in a table?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
To retrieve the actual declared data types, for example for use in dynamic SQL to ALTER COLUMNs, something like this can be used:
It will give you information about all the columns from the table .
Using TSQL/MSSQL
This query will get you: table name, column name, data type, data type length, and allowable nulls
The only thing that needs to be changed is your_table_name.
The easiest way in TSQL is:
In TSQL/MSSQL it looks like:
This will return the values Column Name, showing you the names of the columns, and the Data Types of those columns (ints, varchars, etc).