Is there a way to index a varchar column as datetime?

I am querying a varchar column containing all valid dates. In the query, I passed the column to datetime.

Keep in mind that changing the column type definition in datetime is not an option. Just believe me, this is not an option.

As a result of analyzing the queries, I see that the query will be much faster if I could add an index to this column. But this is a cook. If I added an index, it would index based on this varchar value, right? But I would like it to index the datetime value, right?

Is there anything I can do for the index?

+3
source share
2 answers

- , , DATETIME, 1 1900 , .

SQL Server , :

  • A , , ALTER TABLE . .
  • ( AKA),
  • , ( , ), , .
+6

? varchar-to-datetime , .

. SQL Server 2005 . , . , , .

+3

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


All Articles