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

  • Home
  • SEARCH
  • 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 8640511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:17:51+00:00 2026-06-12T11:17:51+00:00

What is the total character limit for a 900 byte index limit that SQL

  • 0

What is the total character limit for a 900 byte index limit that SQL Server 2012 has. I created a column that has varchar(2000), but I think that it exceeding the 900 byte that SQL Server limited? What would be a max varchar(?) to fit inside the 900 byte index column?

  • 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-12T11:17:53+00:00Added an answer on June 12, 2026 at 11:17 am

    The storage size for varchar is the actual length of the data entered + 2 bytes. Even though the column itself has that 2 byte overhead, you can put up to 900 byte varchar values into a column which is indexed.

    In practice, you can create an index on a column larger than 900 bytes in size, but you will have a problem if you actually try to insert something larger than 900 bytes:

    create table test (
        col varchar(1000)
    );
    create index test_index on test (col);
    -- Warning! The maximum key length is 900 bytes. The index 'test_index' has maximum length of 1000 bytes. For some combination of large values, the insert/update operation will fail.
    insert into test select cast(replicate('x', 899) as varchar(1000)); -- Success
    insert into test select cast(replicate('y', 900) as varchar(1000)); -- Success
    insert into test select cast(replicate('z', 901) as varchar(1000)); -- Fail
    -- Msg 1946, Level 16, State 3, Line 8
    -- Operation failed. The index entry of length 901 bytes for the index 'test_index' exceeds the maximum length of 900 bytes.
    

    Be aware that the 900-byte limit includes all columns of a given index key, as this example shows:

    create table test (
          col varchar(1000)
        , otherCol bit -- This column will take a byte out of the index below, pun intended
    );
    create index test_index on test (col, otherCol);
    insert into test select cast(replicate('x', 899) as varchar(1000)), 0; -- Success
    insert into test select cast(replicate('y', 900) as varchar(1000)), 0; -- Fail
    insert into test select cast(replicate('z', 901) as varchar(1000)), 0; -- Fail
    

    For these columns that are normally too large for an index key, you may be able to gain some benefits of indexing by including them in an index.

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

Sidebar

Related Questions

Total noob here. This is my first c# attempt, its a console application that
total nubi here and i'm trying to writ an application that trackes how far
For Email addresses, how much space should I give the columns in SQL Server.
Requirements: Return total count of files (records) for date. Assign a modifier (single character
If column text contains characters like \<a only first character, \ is displayed in
The goal of the project is to check the total character count of a
total newbie here. i was trying to replace a character in char * but
Total noob here with javascript. I'm trying to alter a function. This is the
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload
Total noobie question here. I'm just learning Java, and studying passing arguments to functions.

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.