Monday, March 12, 2012

How can we list all the tables without any clustered index within a SQL Server 2005 database?

Hi ,All,

Would please anyone here give me any advice and guidance for how to list all the tables without a clustered key within a SQL Server 2005 database?

Thanks a lot in advance for that.

With best regards,

Yours sincerely,

Switch to the database you want to analyse and run this script:

select

sys.schemas.nameas [Schema],

sys.tables.nameas [Table]

from sys.tables

leftouterjoinsys.schemasonsys.schemas.schema_id =sys.tables.schema_id

where sys.tables.object_id not in

(

select

sys.indexes.object_id

fromsys.indexes

wheresys.indexes.type= 1

)

|||

Hi, Daniel, thanks a lot.

With best regards,

|||

Take a look at

http://msdn2.microsoft.com/en-us/library/ms345522.aspx#_FAQ1

It answers exactly the question you have asked

|||

Hi, Asvin, thanks a lot for the link. It's very helpful.

With best regards,

Yours sincerely,

No comments:

Post a Comment