SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE SQDR.STATUSINDEXES
	@tschema nvarchar(128) ,
	@tname nvarchar(128)
	
AS

DECLARE @sql nvarchar(500)

set @sql = N'SELECT  i.name, i.is_disabled FROM sys.indexes i 
   JOIN sys.tables t ON i.object_id = t.object_id 
   INNER JOIN sys.schemas s ON t.schema_id = s.schema_id 
   WHERE  t.name=''' + @tname + ''' and s.name=''' + @tschema + ''' ORDER BY t.name, i.name;'
   PRINT @sql
   EXEC sp_executesql @sql
RETURN
GO
