Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Data Warehousing / April 2005

Tip: Looking for answers? Try searching our database.

index views ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jerome - 21 Apr 2005 08:47 GMT
Hi,

Is it possible to create some kind of indexes on views
based on a substring column ?

View PROD_NAME:
Select  substring (PROD_STRING,10,20) as PROD_NAME, PROD_NO
from PROD_TABLE

View PROD_TYPE:
Select  substring (PROD_STRING,5,5) as PROD_TYPE, PROD_NO
from PROD_TABLE

Of course it would be better to have separate columns in
PROD_TABLE but (for me) it is not possible to change or
set triggers for updating alternative tables.

We use SQL2000 st ed SP3.

/Jerome
Jacco Schalkwijk - 21 Apr 2005 13:32 GMT
You can create indexed view in SQL Server 2000, but they will only work
seamlessly if you have Enterprise Edition. With Enterprise Edition the Query
Optimizer will look to use indexed views even if the view isn't directly
used in the SQL statement. With Standard Edition, you can create indexed
views, but they will only be used by the Query Optimizer if you access them
directly and use the WITH(NOEXPAND) clause, for example:

SELECT PROD_NAME, PROD_NO FROM PROD_NAME WITH (NOEXPAND)

However, if you can make changes to your tables, you can use a computed
column and index that column:

ALTER TABLE PROD_TABLE ADD substring (PROD_STRING,5,5) as PROD_TYPE,
substring (PROD_STRING,10,20) as PROD_NAME

Signature

Jacco Schalkwijk
SQL Server MVP

> Hi,
>
[quoted text clipped - 16 lines]
>
> /Jerome
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.