Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-07-24 : 21:21:11
|
| Am i missing something? I have a varchar max column that is getting read from heavily to build another table. So i want to index it. Right? Well, the index you see below is giving me the error below when i try to build it. Why?CREATE INDEX IX_Abuse_COLUMN ON DouglasConversion.dbo.ActionDescriptorsParsed ([action])Msg 1919, Level 16, State 1, Line 1Column 'Action' in table 'DouglasConversion.dbo.ActionDescriptorsParsed' is of a type that is invalid for use as a key column in an index. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-24 : 23:07:03
|
| Yep...you're see below excerpt from books online under CREATE INDEX...Columns that are of the large object (LOB) data types ntext, text, varchar(max), nvarchar(max), varbinary(max), xml, or image cannot be specified as key columns for an index. Also, a view definition cannot include ntext, text, or image columns, even if they are not referenced in the CREATE INDEX statement.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2012-07-25 : 00:43:24
|
| You want to index the keys that cause it to be identified/selected, not the value itself.If the key(s) and the contents of the column are one and the same or the varchar(max) contains the key then you probably need to reconsider your data model. |
 |
|
|
|
|
|
|
|