How to get ColumnNames, datatypes and length

This is a followup to the script submitted by srallapalli. One can return a record set of all tables in a database using the following:USE MyDatabaseSELECT so.name AS TableName, sc.name AS ColumnName,  st.name AS ColumnDatatype,  convert(int, sc.length) AS ColumnLength FROM syscolumns sc, sysobjects so , systypes st WHERE so.type='U' AND OBJECTPROPERTY(so.id,'ismsshipped') = 0 AND sc.id=so.id […]

2003-05-10

130 reads

Blogs

Azure SQL Database – Azure Portal Updates

By

A small but useful change has been made to the Azure Portal for Data...

SQL Server Quick Tips

By

Earlier this year I made a series of videos that were played before the...

The 2019 State of DevOps Report–Webinar

By

Tomorrow I get to chat with another giant in the world of DevOps: Jez...

Read the latest Blogs

Forums

Is Data the Future of the Vibrant Web?

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Is Data the Future of...

Tsql/SP Code Optimization

By sizal0234

Hi, I am working on optimizing some of Tsql code for SP's. I know...

Powershell

By sizal0234

Does PS help in performance. Like instead of TSQL code used in sql agent...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers