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 137009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:02:19+00:00 2026-05-11T07:02:19+00:00

I have an user scalar-valued function which takes NVARCHAR(MAX) and returns NVARCHAR(MAX). To increase

  • 0

I have an user scalar-valued function which takes NVARCHAR(MAX) and returns NVARCHAR(MAX). To increase perfomance of GROUP BY command utilizing this function I wanted to create an index also based on it. But documentation says what CREATE INDEX command only takes columns not expressions, so this is illegal:

CREATE INDEX an_index ON a_table (foo(a_column)) 

Are any workarounds?

Thank you!

  • 1 1 Answer
  • 2 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-11T07:02:20+00:00Added an answer on May 11, 2026 at 7:02 am

    You’ll need to create a computed column:

    CREATE TABLE a_table (a_column NVARCHAR(MAX), a_foo AS foo(a_column)) CREATE INDEX an_index ON a_table (a_foo) 

    In order to be indexable, the function foo must, of course, meet certain demands:

    Indexing Computed Columns That Invoke a User-Defined Function

    A computed column that invokes a user-defined function can be used in an index when the user-defined function has the following property values:

    • IsDeterministic = true
    • IsSystemVerified = true (unless the computed column is persisted)
    • UserDataAccess = false
    • SystemDataAccess = false

    You cannot build an index on a non-deterministic function like GETDATE that changes its return value every time you call it.

    It will be even easier to solve your case if you post the function you want to index on.

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

Sidebar

Related Questions

I have a user defined function in a SQL Server 2005 database which returns
I am using a Scalar-Valued Function to find out if a user of the
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
i have user control, which i render on several views. i want to show
I have a user which contains a reference field o which points to an
I have user control in my MVC2 app placed in the Content folder (it's
I have user generated podcasts, each with their own RSS feed. Is there a
I have User and Teacher models. Teacher belongs_to User and User has_one Teacher. Also
We would like to have user defined formulas in our c++ program. e.g. The
If I have user id variable, what is correct java naming convention for it?

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.