List columns using INFORMATION_SCHEMA

09 April,2014 by Jack Vamvas

Question: How can I list all columns in a database?  I don’t know in which table the column exists.

I've read  Find column data types using sys.types and sys.syscolumns

Answer: You can use either the SYS or INFORMATION_SCHEMA  metadata schemas. I prefer to use the INFORMATION_SCHEMA .   The reasons are:

1)      INFORMATION_SCHEMA are ISO compliant. The theory is you can migrate queries across other ISO compliant database server platforms.

 2)      I support  multiple database plaforms, so portability of code is useful. If I were supporting only SQL server – the sys views have a better level of detail .

Read More

Calculate sql row size - SQL Server DBA

SQL Server – Format number with commas using money sql data type

SQL Server - Arithmetic overflow error converting expression to data type int and COUNT_BIG


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on List columns using INFORMATION_SCHEMA


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer