index legth

  • let say that we have a varchar(100) column and a index on that column

    in mysql I can set the index length to any number smaller than 100.. if I set the index length to 5 then the index will consider only first 5 characters from each row

    Can I set same thing in MSSQL? How?

  • As far as I know this isn't possible in SQL Server.

    You could create a computed column that takes the first 5 characters of your column and put an index on the computed column.

    Indexes on Computed Columns

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • bruce-347665 (12/13/2012)


    let say that we have a varchar(100) column and a index on that column

    in mysql I can set the index length to any number smaller than 100.. if I set the index length to 5 then the index will consider only first 5 characters from each row

    Can I set same thing in MSSQL? How?

    I don't think there is any index length set up in sql server; it is handled internally by sql server engine.

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply