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 .
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
This is only a preview. Your comment has not yet been posted.
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.
Posted by: |