How to get Table structure/Column information using SQL Query
There are different ways to fetch database 'Tables' or 'Views' structure INFORMATION_SCHEMA views: Microsoft has introduced 20 different views to fetch helpful database information as part of SQL Server database 2005 and onward. We will use 'columns' view to fetch table structure information In my openion, this is the easiest way to fetch table structure information e.g., column name, data type, size, isnullable, table schema etc. to fetch table structure select * from INFORMATION_SCHEMA.columns where TABLE_NAME = 'tablename' or select column_name, data_type, is_nullable, character_maximum_length from INFORMATION_SCHEMA.columns where TABLE_NAME = 'tablename' using database name as prefix select * from database. INFORMATION_SCHEMA.columns where TABLE_NAME = 'tablename' ----------------------------------- syscolumns & systypes: Getting columns and other structural information of a table select name ,...