Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

IsIndexable command

Anyone have syntax for IsIndexable command
0
TimSweet220
Asked:
TimSweet220
  • 4
  • 2
1 Solution
 
knightEknightCommented:
Do you mean this?

SELECT TABLE_TYPE, TABLE_NAME
  , OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), 'IsIndexable') AS IsIndexable
FROM INFORMATION_SCHEMA.TABLES
0
 
TimSweet220Author Commented:
Sorry..need it for see if a View is indexable
0
 
knightEknightCommented:
that should do it, no?

SELECT *
  , OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), 'IsIndexable') AS IsIndexable
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'NameOfYourView'
order by 4,2,3
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
knightEknightCommented:
For a view you can check the 'IsSchemaBound' property:

SELECT *
  , OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), 'IsIndexable') AS IsIndexable
  , OBJECTPROPERTY (OBJECT_ID(TABLE_NAME),'IsSchemaBound') AS IsSchemaBound
FROM INFORMATION_SCHEMA.TABLES
--WHERE TABLE_NAME = 'NameOfYourView'
order by 4,2,3
0
 
knightEknightCommented:
I forgot to add this to the WHERE clause:

WHERE TABLE_TYPE = 'VIEW'
0
 
TimSweet220Author Commented:
Excellent. Thank you.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now