existe t'il une commande pour connaitre le nombre d'index=20
et eventuellement leur nom sur une table donn=E9e et=20
eventuellement sur une database complete.
"Troyan" wrote in message news:0aa401c355d6$b00f4960$ Bonjour,
existe t'il une commande pour connaitre le nombre d'index et eventuellement leur nom sur une table donnée et eventuellement sur une database complete.
Merci.
lionelp
Bonjour,
pour une table select name from sysindexes where id=object_id('ma_table') and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_% select count(*) from sysindexes where id=object_id('ma_table') and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_%
Pour la base select name from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_%
select count(*) from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_%
ou encore: use master go create proc sp_index_info 'authors' @table_name varchar(250)=null as if @table_name is null begin select name as 'List of indexes in current database' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%'
select count(*) as 'Number of indexes in current database' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%' return end select name as 'List of indexes for current table' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%' and id=object_id(@table_name)
select count(*) as 'Number of indexes for current table' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%' and id=object_id(@table_name) return go
Cordialement, LionelP
"Troyan" wrote in message news:0aa401c355d6$b00f4960$ Bonjour,
existe t'il une commande pour connaitre le nombre d'index et eventuellement leur nom sur une table donnée et eventuellement sur une database complete.
Merci.
Bonjour,
pour une table
select name
from sysindexes
where id=object_id('ma_table')
and indid>0
and name not like '_Wa_Sys_%
and name not like 'hind_%
select count(*)
from sysindexes
where id=object_id('ma_table')
and indid>0
and name not like '_Wa_Sys_%
and name not like 'hind_%
Pour la base
select name
from sysindexes
where id>99
and indid>0
and name not like '_Wa_Sys_%
and name not like 'hind_%
select count(*)
from sysindexes
where id>99
and indid>0
and name not like '_Wa_Sys_%
and name not like 'hind_%
ou encore:
use master
go
create proc sp_index_info 'authors'
@table_name varchar(250)=null
as
if @table_name is null
begin
select name as 'List of indexes in current database'
from sysindexes
where id>99
and indid>0
and name not like '_Wa_Sys_%'
and name not like 'hind_%'
select count(*) as 'Number of indexes in current database'
from sysindexes
where id>99
and indid>0
and name not like '_Wa_Sys_%'
and name not like 'hind_%'
return
end
select name as 'List of indexes for current table'
from sysindexes
where id>99
and indid>0
and name not like '_Wa_Sys_%'
and name not like 'hind_%'
and id=object_id(@table_name)
select count(*) as 'Number of indexes for current table'
from sysindexes
where id>99
and indid>0
and name not like '_Wa_Sys_%'
and name not like 'hind_%'
and id=object_id(@table_name)
return
go
Cordialement,
LionelP
"Troyan" <c.perez@e-sama.com> wrote in message
news:0aa401c355d6$b00f4960$a401280a@phx.gbl...
Bonjour,
existe t'il une commande pour connaitre le nombre d'index
et eventuellement leur nom sur une table donnée et
eventuellement sur une database complete.
pour une table select name from sysindexes where id=object_id('ma_table') and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_% select count(*) from sysindexes where id=object_id('ma_table') and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_%
Pour la base select name from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_%
select count(*) from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_% and name not like 'hind_%
ou encore: use master go create proc sp_index_info 'authors' @table_name varchar(250)=null as if @table_name is null begin select name as 'List of indexes in current database' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%'
select count(*) as 'Number of indexes in current database' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%' return end select name as 'List of indexes for current table' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%' and id=object_id(@table_name)
select count(*) as 'Number of indexes for current table' from sysindexes where id>99 and indid>0 and name not like '_Wa_Sys_%' and name not like 'hind_%' and id=object_id(@table_name) return go
Cordialement, LionelP
"Troyan" wrote in message news:0aa401c355d6$b00f4960$ Bonjour,
existe t'il une commande pour connaitre le nombre d'index et eventuellement leur nom sur une table donnée et eventuellement sur une database complete.