Skip to main content

Posts

Showing posts from August, 2018

Fetch all Table Names with Column Names and Data types from SQL Server Database

The below script will provide the list of table name along with column names and data types. SELECT T.Name AS TableName, Schema_name(T.schema_id) AS SchemaName, C.Name AS ColumnName, Ty.Name AS ColumnDataType, C.is_nullable AS IsNullAble, C.is_identity AS IsIdentity FROM sys.tables T INNER JOIN sys.columns C ON T.OBJECT_ID = C.OBJECT_ID INNER JOIN sys.types Ty ON C.system_type_id = Ty.system_type_id WHERE T.is_ms_shipped = 0 ORDER BY T.name