/ Published in: SQL
this little snippet can be used to compare an SAP Date (which might be empty, or '00000000') to today's date, for instance to query for rows that have been closed in the last x days. Can't CAST the date column (in 'YYYYMMDD' format) to a date for use in where clauses, since '00000000' can't be cast to a datetime
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
CAST(CONVERT( CHAR(8),GETDATE(),112) AS INT)-A.IDAT2 <= @CompletedDateWindow