Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 171977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:05:01+00:00 2026-05-11T13:05:01+00:00

I am trying to create an index on the following view: SELECT ‘Candidate’ AS

  • 0

I am trying to create an index on the following view:

SELECT     'Candidate' AS Source, CandidateID AS SourceId, LastName + ', ' + FirstName AS SourceName FROM         dbo.Candidates UNION SELECT     'Resource' AS Source, ResourceID AS SourceId, LastName + ', ' + FirstName AS SourceName FROM         dbo.Resources UNION SELECT     'Deal' AS Source, DealID AS SourceId, CONVERT(varchar, Number) + '-' + CONVERT(varchar, RevisionNumber) AS SourceName FROM         dbo.Deals UNION SELECT     'Job Order' AS Source, JobOrderID AS SourceId, CustomerNumber AS SourceName FROM         dbo.JobOrders 

I am getting the following error:

Msg 1939, Level 16, State 1, Line 2 Cannot create index on view '_Source' because the view is not schema bound. 

I added WITH SCHEMABINDING to the CREATE and now get the following error:

Msg 10116, Level 16, State 1, Line 2 Cannot create index on view 'DEALMAKER.dbo._Source' because it contains one or more UNION, INTERSECT, or EXCEPT operators. Consider creating a separate indexed view for each query that is an input to the UNION, INTERSECT, or EXCEPT operators of the original view. 

My questions are:

How would I create an index on this view? Would creating separate indexed views really work?

Lastly, am I really going to see a performance improvement for any queries that may JOIN this view?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:05:02+00:00Added an answer on May 11, 2026 at 1:05 pm

    You cannot create an index on a view that makes use of a union operator. Really no way around that, sorry!

    I would imagine you’ve seen this, but check out this MSDN page. It gives the requirements for indexed views and explains what they are and how they work.

    As to whether or not you’d see a performance benefit if you COULD index the view, that would depend entirely on the size of your tables. I would not expect any impact on creating separate indexed views, as I would assume that your tables are already indexed and you aren’t doing any joining or logic in the view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an indexed view and get the following error creating the
I am trying to create an index using EF Code Migrations. The index looks
I'm trying to create an index page where all assets are displayed including a
I am trying to create an index using Elastic Search Java API. My code
I am trying to create full text index but I am getting error which
I'm trying to create a nice generic way of setting the tab index on
I'm trying to create a custom deployer in Tridion 2011 SP1 that can index
Possible Duplicate: Multiple index variables in PHP foreach loop I am trying to create
I'm trying to create tiny urls like this: site.com/abc123 goes to: site.com/index.php?token=abc123 but I
I am trying to create a partial view I call ImageViewer. It will be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.