Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql query to get column names and data types in sql server

SELECT COLUMN_NAME, 
	DATA_TYPE, 
    IS_NULLABLE, 
    CHARACTER_MAXIMUM_LENGTH, 
    NUMERIC_PRECISION, 
    NUMERIC_SCALE 
FROM 'your_database_name'.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='your_table_name';
Comment

sql server get type of column

SELECT 
    COLUMN_NAME, 
    DATA_TYPE, 
    CHARACTER_MAXIMUM_LENGTH AS MAX_LENGTH, 
    CHARACTER_OCTET_LENGTH AS OCTET_LENGTH 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_NAME = 'table_name' 
AND COLUMN_NAME = 'column_name';
Comment

get column types SQL SERVER

SELECT DATA_TYPE 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE 
     TABLE_SCHEMA = 'yourSchemaName' AND
     TABLE_NAME   = 'yourTableName' AND 
     COLUMN_NAME  = 'yourColumnName'
Comment

PREVIOUS NEXT
Code Example
Sql :: sql server check version 
Sql :: while loop sql 
Sql :: installer postgresql sur ubuntu 
Sql :: get current date in pyspark sql 
Sql :: c# datetime to sql server datetime 
Sql :: sql delete multiple ids 
Sql :: flutter sqlite auto incrementing id primary key 
Sql :: fetch first 10 rows in oracle sql developer 
Sql :: search stored procedures by name 
Sql :: raise application error in oracle 
Sql :: alter table delete column 
Sql :: delete database mysql 
Sql :: how to group by month using sql server 
Sql :: mysql concatenate two columns into one 
Sql :: sqlite list columns 
Sql :: mysql remove unique constraint 
Sql :: grant lock tables privilege mysql 
Sql :: how to add a index to live table sql 
Sql :: sql convert datetime to year month 
Sql :: second last highest id in sql 
Sql :: sql how to replace full stop 
Sql :: mysql date diff in seconds 
Sql :: mysql get first 2 characters of string 
Sql :: check mysql timezone 
Sql :: starting mysql service from mac 
Sql :: pop sql insert value into 
Sql :: sql select roundup column 
Sql :: postgresql division count return 0 
Sql :: sql delete records older than 1 day 
Sql :: set all the vluses in calumn in sql to false 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =