How to do the same? I need that for comparing two fields which differ by time, which we dont mind. Only if the dates are different, we need to take care. We are using Sybase with Crystal Reports
If the comparison you are performing is in Crystal Reports, then you can use the Crystal Reports Date function:
Date( {datetime expression} ).
If you are trying to do this in ASA, ASA has a similar Date function.
ASE may also support a similar function but I don't know for sure as I haven't used it enough to remember.
Either of these methods are probably more efficient than converting to varchar because it allows for a numeric comparison rather than a string comparison.
If your logic is being used in a WHERE clause, and you want it to take advantage of indexing, you'll need to use a compound logical expression. The following example would be capable of using an index on MyTimestamp1 if it existed:
WHERE
MyTimestamp1 >= Date(MyTimestamp2)
and
MyTimestamp1 < Date(MyTimestamp2 + 1)
This at least standardizes all datetimes in your column to having the exact timestamps. Then you can easily filter a Cognos report that prompts the user for a date.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.