Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
abc123
Starting Member
47 Posts |
Posted - 2009-03-19 : 03:35:25
|
| I want the give list of all indexes (clustered and nonclustered)created on the all user created tableI have written following queryselect b.name,a.namefrom sysobjects ainner join sysindexes bon a.id = b.id left join INFORMATION_SCHEMA.TABLE_CONSTRAINTS con a.name = c.TABLE_NAMEand c.CONSTRAINT_NAME = b.nameand c.CONSTRAINT_TYPE <> 'PRIMARY KEY'where a.xtype='U' It is returning folllowing dataPK_table1 table1_WA_Sys_0000000C_22AA2996 table1_WA_Sys_00000002_22AA2996 table1i want only 1st row don't want 2 and 3 . |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-03-19 : 07:00:13
|
| select b.name,a.namefrom sysobjects ainner join sysindexes bon a.id = b.idleft join INFORMATION_SCHEMA.TABLE_CONSTRAINTS con a.name = c.TABLE_NAMEand c.CONSTRAINT_NAME = b.nameand c.CONSTRAINT_TYPE <> 'PRIMARY KEY'where a.xtype='U'and Indexproperty(b.id, b.name, 'IsStatistics')=0 |
 |
|
|
|
|
|