Hakan Axheim

Hakan Axheim

  • NA
  • 201
  • 32.4k

Regarding datatypes in SqlServer

Mar 6 2018 6:44 AM
Hi,
 
In our application we are about to use two different tables. One table is created for several years ago and the other table is created during development right now. 
 
The columns that I am intressed about in the old column is enddate and end time. Those who have created that table has specified the enddate as an datetime and end time as char(5). This is stupid but I cannot change the table because it's so many programs that are dependent on this table. In our new table we have both date and endtime in one column that has datetime as datatype.
 
We have done a stored procedure that extracts data from those tables. I got the right amount of data but when I look into the exution plan in Management Studio it seems that SQLServer has turned of index which results in slow performance. Is there any way to get around this problem.

(old.enddate + old.time) < new.enddate  

Answers (3)