Guest User

Untitled

a guest
Jun 28th, 2012
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE @DBName     VARCHAR(50)
  2. DECLARE @TableName  VARCHAR(50)
  3. SET @DBName = 'Test_DB'
  4. SET @TableName = 'Test_DB.dbo.ExampleTable'
  5. SELECT DB_ID(@DBName) AS databaseID,
  6. @DBName AS databaseName,
  7. OBJECT_ID(@TableName) AS objectID,
  8. OBJECT_NAME(OBJECT_ID(@TableName), DB_ID(@DBName)) AS objectName,
  9. index_id AS indexID,
  10. name AS indexName,
  11. 1 AS exclusionMask
  12. FROM sys.indexes
  13. WHERE object_id = OBJECT_ID(@TableName)
RAW Paste Data