Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. if object_id('dbo.tTestIndex') is not null
  2. drop table dbo.tTestIndex;
  3.  
  4. create table dbo.tTestIndex (a int, b int, c int);
  5.  
  6. create index X_tTestIndex on dbo.tTestIndex (a) include (b) where c > 0;
  7.  
  8. select i.name, i.filter_definition, c.name, ic.is_included_column
  9. from sys.indexes i
  10. inner join sys.index_columns ic on i.object_id = ic.object_id and i.index_id = ic.index_id
  11. left join sys.columns c on ic.object_id = c.object_id and ic.column_id = c.column_id
  12. where i.object_id = object_id('dbo.tTestIndex');
  13.  
  14. if object_id('dbo.tTestIndex') is not null
  15. drop table dbo.tTestIndex;
  16.  
  17. index_name | filter_definition | column_name | is_included_column
  18. -------------+-------------------+-------------+-------------------
  19. X_tTestIndex | ([c]>(0)) | a | 0
  20. X_tTestIndex | ([c]>(0)) | b | 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement