indexing - SQL Server indexes cause conversion issue -


I have a table with two columns- for any reason the date stored in the form of ID and nerve as IT

A non-package index was recently created on the ID field. Now in my query, when I change the date of narration from date to date, it gives me an 'arithmetic overflow error in expression, at the date of the data type.' exception.

If I extract the id field from my query, the conversion works perfectly, so if I remove the date field conversion from my query, it works completely again. If I leave the index, the original query works perfectly.

My question is, why is an index on the ID column messing up the conversion in the Cas-I-Think-Us-unrelated, Date column?

Any explanation on this is very much appreciated. And the query is: Select

  e.date, e.id as id from dbo.table1 e, with dbo.table2d (nolock) where e.id = d Convert .id and convert (datetime, E.date, e.id    (date time, '07 / 01/2012 ') and convert (date time, '07 / 02/2012) Div> 

There are invalid date values ​​in the Date column in your table Add indexes and change what columns are returning Your query There is a change in the query plan, so this invalid day Evaluates the values ​​of the values.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -