Richard Rothe wrote: > Our third-party software stores dates in some files as four numeric > fields to store century/year/month/day. > > I need to select invoices for a specific date, so I have done the > code below. When I run the statement in interactive SQL it brings the > system to its knees. CPU utilization goes ove 90%. > > Is there a better way to do this in SQL ? Richard, I don't have the commands on hand, but you might try something like this: instead of converting every record to date for comparison purposes, why not convert the Current Date to simpler values that more closely resemble the four fields? Split out the century, year, month and day values from Current Date and use them in 4 different tests. This should allow an index over these fields to be used. Bill
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
Date comparison in where clause
Collapse
X
-
Date comparison in where clause
Even if you don't do the indexes, the technique Richard suggests can work. It you split up the current date, that operation will only be done once, instead of doing the convoluted concat once for every single record. -dan
-
Date comparison in where clause
Our third-party software stores dates in some files as four numeric fields to store century/year/month/day. I need to select invoices for a specific date, so I have done the code below. When I run the statement in interactive SQL it brings the system to its knees. CPU utilization goes ove 90%. Is there a better way to do this in SQL ?
Code
Comment
Comment