Solved

IsIndexable command

Posted on 2011-09-16
6
271 Views
Last Modified: 2012-05-12
Anyone have syntax for IsIndexable command
0
Comment
Question by:TimSweet220
  • 4
  • 2
6 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 36551393
Do you mean this?

SELECT TABLE_TYPE, TABLE_NAME
  , OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), 'IsIndexable') AS IsIndexable
FROM INFORMATION_SCHEMA.TABLES
0
 

Author Comment

by:TimSweet220
ID: 36551405
Sorry..need it for see if a View is indexable
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 36551454
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 33

Expert Comment

by:knightEknight
ID: 36551467
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
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 36551473
I forgot to add this to the WHERE clause:

WHERE TABLE_TYPE = 'VIEW'
0
 

Author Closing Comment

by:TimSweet220
ID: 36560832
Excellent. Thank you.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Microsoft SQL Queries 11 48
C# SQL BULK INSERT CLASS 5 34
Distinct values from two tables 14 18
Numeric sequence in SQL 14 36
In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now