Beas is compatible to MSSQL and HANA Server
But both have different SQL Syntax.
The internal SQL Runtime converter allow you to convert many HANA Syntax automatically to MSSQL Syntax
Write allways in Hana-Format for follow commands
For this you can use the integrated Tools -> Query -> SQL HANA Converter
Follow functions are converted in beas-MSSQL
Use HANA-Syntax in MS - SQL |
is converting in (MS SQL) |
select 'A'||'B' ,3+5 from "BEAS_DUMMY" |
select 'A'+'B',3+5 from "BEAS_DUMMY" |
select IfNull("ItemCode") from "OITM" Alternative: use coalesce |
select isnull(itemcode) from OITM |
select now() from "BEAS_DUMMY" |
select getdate() from BEAS_DUMMY |
select max(5) "ItemCode" from "OITM" |
select top 5 ItemCode from OITM |
select rpad(' ',10) as emptystring from "BEAS_DUMMY" |
select replicate(' ',10) as emptystring from BEAS_DUMMY |
select add_date(now(),5) from "BEAS_DUMMY" |
select dbo.add_date(getdate(),5) from BEAS_DUMMY (the function dbo.add_date use dateadd(xx,yy) ) |
select to_varchar(now(),'yyyy-mm-dd') |
select dbo.to_varchar(getdate(),'yyyy-mm-dd') (the function dbo.to_varchar use convert) |
Alternativ commands for Single Source
MSSQL |
hana |
Alternativ |
select isnull(a,b) |
select ifnull(a,b) |
select coalesce(a,b) |
select 'hello'+'world' |
select 'hello'||'world |
select concat('hello'||'world') |
select space(50) |
select rpad(50) |
select cast('' as nvarchar(50)) |
Use follow commands in MSSQL-World
Info |
Correct |
Wrong |
use Cast and not Convert |
select cast("OnHand" as varchar) as onHandAsVarchar from "OITW" |
select convert(varchar(20),"OnHand") as onHandAsVarchar from "OITW" |
use from "BEAS_DUMMY" if you've no reference to a table |
select 1+2 from "BEAS_DUMMY" |
select 1+2 |
use "||" if you add a string but use "+" for adding numbers |
select 'A'||'B',3+4 from "BEAS_DUMMY" |
select 'A'+'B',3+4 |
don't use dateadd(x,y) use add_date(), add_month(), add_year(), |
select add_year(now(),5) |
select dateadd(yy,getdate()) |
convert datetime use dbo.to_varchar(x,y) |
select to_varchar(now(),'yyyy-mm-dd') |
select cast (now() as varchar(10)) |