Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

"Declare"

$
0
0


Hello Experts,

i am new to SAP HANA, i am quite familiar in SQL microsoft sql studio and this query works there perfectly.

We are in the process of transition to HANA and i am having difficulty updating/changing this Query to work in HANA.

Can anyone offer any suggestions?

 

declare @WMSDB varchar(30)
select @WMSDB = 'AISWM'+DB_NAME()
declare @xAISWMEventLog varchar(250)
select  @xAISWMEventLog = 'CREATE SYNONYM xAISWMEventLog FOR '+ @WMSDB+'.dbo.xAISWMEventLog'
exec(@xAISWMEventLog)

select [DateTime],
CASE when YEAR(datetime) = YEAR(GETDATE()) then 1 else 0 end as YTD,
CASE when YEAR(datetime) = YEAR(GETDATE()) and Month(datetime) = month(GETDATE()) then 1 else 0 end as MTD,
CASE when YEAR(datetime) = YEAR(GETDATE()) and Month(datetime) = month(GETDATE()) and day(datetime) = day(GETDATE()) then 1 else 0 end as TODAY,
UserID,SOID,DocEntry, InvtID, WhseLoc,LineRef,SiteID, SlpCode, a.Quantity, LineTotal
FROM xAISWMEventLog a
left outer join RDR1 on rdr1.DocEntry = a.soid and rdr1.LineNum = a.LineRef
  where
     a.EventTyp = 'SHIP' and a.LnAction = 'Finish'

drop SYNONYM xAISWMEventLog

 




Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>