SAP Date Comparison

/ Published in: SQL
Save to your folder(s)

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

Copy this code and paste it in your HTML
  1. CAST(CONVERT( CHAR(8),GETDATE(),112) AS INT)-A.IDAT2 <= @CompletedDateWindow

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.