$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content

HANA SQL SCRIPT MONTHS_BETWEEN Function is not working

Mar 12, 2017 at 04:22 PM


avatar image
Former Member

Hi All,

I tired the below HANA SQL standard function to get difference between two dates but it is working only for "DAYS_BETWEEN" not for Months and Years. I followed the below SQL reference


Error Log

I got some solution from SCN https://archive.sap.com/discussions/thread/3877237

As i am working on Demo Hana cloud server i am not able to access it .

My question is why the standard date function " MONTHS_BETWEEN" and "YEARS_BETWEEN" are not working as "DAYS_BETWEEN?

Thank you All :)

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Mar 12, 2017 at 06:11 PM

Both functions MONTHS_BETWEEN and YEARS_BETWEEN are added to HANA with HANA 1.0 SPS12. So I assume you are on a lower release level (DAYS_BETWEEN is already available since some SPS).

The link to the (legacy) online documentation, points to HANA 2.0 SPS00 in which the functions of course available too.


Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for your reply : ) . Yes it's current version in 1.00.097 . I am using SAP HANA trail version . Is HANA 2.0 is available in HANA trail version? You have any idea about it ?


Seems like you are using a shared HANA instance which is still on HANA 1.0 SPS9 level. The HANA MDC instance available on SAP CP Trial is at level HANA 1.0 SPS12.

Former Member

Thank you so much :) HANA MDC Trail instance is working perfect .