Create index on partial column CHAR

I have a CHAR (250) column that is used as a foreign key for a varchar (24) column.

In MySQL, I remember that I could create a column defining an index (24) to create an index for the left-most 24 characters. This is not possible on MS SQL Server.

My question is:

Can SQL Server 2008 indexed view be used to index the substring of this column, and if so, will it have any side effects on table performance?

+3
source share
2 answers

, , .

alter table add newcolumn as cast(oldcolumn as varchar(24)) persisted;
create index table_newcolumn on table (newcolumn);
+5

, . , 24 , , .

...

. , . , FK , , , . , .

.

+2

Source: https://habr.com/ru/post/1771602/


All Articles