Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

index legth Expand / Collapse
Author
Message
Posted Thursday, December 13, 2012 6:25 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, June 5, 2014 6:49 AM
Points: 10, Visits: 163
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?
Post #1396155
Posted Thursday, December 13, 2012 6:31 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:15 AM
Points: 13,635, Visits: 11,504
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




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1396157
Posted Thursday, December 13, 2012 6:31 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 11, 2014 9:19 PM
Points: 1,129, Visits: 1,164
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
Post #1396158
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse