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

133 reads

Blogs

Using Write-Debug

By

I wrote a post about PoSh output recently, noting that in general we ought...

T-SQL Tuesday Retrospective #002: A Puzzling Situation

By

For the second T-SQL Tuesday ever — again, hosted by Adam Machanic — we...

Daily Coping 28 Oct 2020

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

Index question

By Admingod

We have some indexes we have changed over the last few years to address...

Getting the top unique value by group

By David.Toews 95002

Alright, so I've been banging my head against the wall for a bit on...

table variable

By mtz676

deleted code resolved issue  

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers