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#
For SQL Server, this system stored procedure will return all table information, including column datatypes:
For Spark SQL:
For IBM DB2 :
Using TSQL/MSSQL
You can use
INTO
keyword.The result of
SELECT
into a real TABLEExample:
select .... INTO real_table_name
After
In my case I needed to get the data type for Dynamic SQL (Shudder!) anyway here is a function that I created that returns the full data type. For example instead of returning 'decimal' it would return DECIMAL(18,4): dbo.GetLiteralDataType
Using SQL Server: