[dba-SQLServer] All tables, columns and indexes

kens.programming kens.programming at verizon.net
Mon Aug 4 14:20:47 CDT 2008


Arthur,

Is something like this what you are looking for?:

SELECT so.name, si.name, sc.name
FROM sysobjects so INNER JOIN sysindexes si ON so.id = si.id 
	INNER JOIN sysindexkeys sik ON si.indid = sik.indid AND so.id =
sik.id
	INNER JOIN syscolumns sc ON sik.colid = sc.colid AND so.id = sc.id
WHERE so.type = 'U'

Ken


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur
Fuller
Sent: Monday, August 04, 2008 11:44 AM
To: Discussion concerning MS SQL Server
Subject: [dba-SQLServer] All tables, columns and indexes

I was building an Excel worksheet to list all the tables in my db in column
A, then the indexes for each table in column B, and the columns in each
index in Column C, because I couldn't figure out how to grab that data in a
single SELECT. Can you help? I can see portions here and there but I'm not
seeing how to grab it all in one grab.

Thanks,
Arthur
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 270.5.12/1590 - Release Date: 8/4/2008
8:09 AM
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 270.5.12/1590 - Release Date: 8/4/2008
8:09 AM
 




More information about the dba-SQLServer mailing list