「UserDb1」データベースにある、「UserShema2」スキーマに紐付くインデックスのみ抽出する、サンプルSQL。
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14  | 
						Declare @dbid int  Select @dbid = db_id('UserDb1')  select a.schema_id, b.name, [Table Name], indes_name from (   SELECT  o.schema_id as schema_id, OBJECT_NAME(i.[object_id]) AS [Table Name] ,i.name as indes_name, o.create_date, o.modify_date  FROM sys.indexes AS i   INNER JOIN sys.objects AS o ON i.[object_id] = o.[object_id]  AND o.[type] = 'U' ) as a   inner join sys.schemas b     on a.schema_id = b.schema_id    and b.name      = 'UserShema2'  | 
					
  
  
  
  

コメント