Wednesday 17 December 2014

Get Table columns names, schema, datatype and more using sql query





select *
 from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='Table Name here'



//For Particular


select '['+COLUMN_NAME+']',DATA_TYPE,

case when CONVERT(varchar, CHARACTER_MAXIMUM_LENGTH)>then CHARACTER_MAXIMUM_LENGTH else '' end as mm,case when IS_NULLABLE='Yes' then 'NULL,' else 'NOT NULL,' end as tt

 from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME=' Table Name here'

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...