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

mssql get data types of columns

SELECT 
	COLUMN_NAME
    ,DATA_TYPE 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE 
     TABLE_SCHEMA = 'yourSchemaName' AND
     TABLE_NAME   = 'yourTableName'
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

view column type sql server

sp_help TableName
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle sql drop column if exists 
Sql :: incompatible sql_mode=only_full_group_by 
Sql :: get data every 30 days in sql 
Sql :: difference between primary key and unique key 
Sql :: how to create a table in sql 
Sql :: sql count null values in all columns 
Sql :: mysql récupérer le code création de vue 
Sql :: mysql trim spaces 
Sql :: constraints to columns SQL 
Sql :: show database cmd 
Sql :: how to know the character set of an oracle databes 
Sql :: check database size in gb mysql 
Sql :: avg sql 
Sql :: round in sql server 
Sql :: psql load dump 
Sql :: how to check table name in current database sql 
Sql :: insert into using contant values and source table columns with sql 
Sql :: mysql to uppercase 
Sql :: select distinct postgres 
Sql :: firebase query timestamp 
Sql :: Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF 
Sql :: update sqlite 
Sql :: mysql: command not found 
Sql :: datediff in sql 
Sql :: sql get duplicates by composite 
Sql :: pivot 
Sql :: sql server delete table 
Sql :: mysql locate 
Sql :: sql server 2019 installation 
Sql :: add foreign key to existing table postgres 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =