Wiki

Scale Your Enterprise

User Tools

Site Tools


bw:hana_sql_tips

This is an old revision of the document!


HANA SQL Tips

This page offers some tips for users that have experience with T-SQL (Microsoft SQL Server) and are switching to SAP HANA SQL.

  • HANA database objects (tables, columns, etc.) are enclosed in double-quotes. Tables do not need to be but it is easier to do it for consistency.
  • HANA database objects are case-sensitive. For example, “CardCode” is valid while “cardcode” would not be recognized.
  • When dealing with null values, the HANA expression is IFNULL, not ISNULL. Otherwise the syntax is the same.
  • HANA uses the function CURRENT_DATE instead of getdate().
  • HANA uses the function EXTRACT instead of DATEPART.
EXTRACT ({YEAR | MONTH | DAY | HOUR | MINUTE | SECOND} FROM <datevalue>)
  • In many cases, SAP Business One stores DateTime values in two separate columns: one for the date and one for the time. The following code can be used to merge these two values into a single DateTime value. In this example, CreateDate and CreateTime are merged into CreateDateTime.
add_seconds(t0."createDate",(round((t0."createTime"/100),0) * 3600) + ((t0."createTime" - (round((t0."createTime"/100),0)*100)) * 60)) as "CreateDateTime"
bw/hana_sql_tips.1570799357.txt.gz · Last modified: 2019/10/11 09:09 by runger