StumbleUpon
Share on Facebook

Monday, September 5, 2011

How to get Column Names of All Tables in a database through SQL Query / SysTables in SQL Server 2008

How to list all tables and each table, loop through each column using SQL query

It is not uncommon to get the list of all column names from all available tables; at times some valuable information peeps out when one researches it. The following query will get you exactly that


select sys.syscolumns.name as ColumnName, sys.sysobjects.name as TableName from sys.syscolumns,sys.sysobjects where sys.sysobjects.id = sys.syscolumns.id



Related Posts Plugin for WordPress, Blogger...