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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:55:09+00:00 2026-06-14T23:55:09+00:00

I have a table Com_Main which contains column CompanyName nvarchar(250) . It has average

  • 0

I have a table Com_Main which contains column CompanyName nvarchar(250). It has average length of 19, max length = 250.

To improve performance I want to add a computed column left20_CompanyName which holds the first 20 characters of CompanyName:

alter table Com_main 
add left20_CompanyName as LEFT(CompanyName, 20) PERSISTED

Then I create Index on this column:

create index ix_com_main_left20CompanyName 
on Com_main (LEFT20_CompanyName)

So when I use

select CompanyName from Com_Main
where LEFT20_CompanyName LIKE '122%'

it uses this nonclustered index, but when the query is like:

select CompanyName from Com_Main 
where CompanyName LIKE '122%'

It uses full table scan, and don’t use this index.

So the question:

Is it possible to make SQL Server use this index on computable column in last query?

  • 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. Editorial Team
    Editorial Team
    2026-06-14T23:55:11+00:00Added an answer on June 14, 2026 at 11:55 pm

    No. MySQL supports partial indexing of varchar columns but MS SQL Server does not.

    You might be able to speed up table scans through partitioning but I don’t know how smart SQL Server is in this regard.

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

Sidebar

Related Questions

Screenshot mockup: http://tinypic.com/r/y2qex/5 Problem: I have a table that has 53 columns; one for
I have table in which I am inserting rows for employee but next time
So I have my table users and each record has a username field and
I have a form which creates a new record in a table. It is
My database name is AppDB.db and table name is Scrip which contains 3 columns
I have programmed a simple hibernate app which isn't updating the table. The following
I have an SQLiteDatabase helper, which returns a cursor with just the name column
I have a scrollable table with last column fixed because that column contain action
I have a page which has an unordered list down one side, to switch
Lets Say i have a table like this WEB_LIST_TABLE KEY Value ---------------------------------------- 134 google.com

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.