question

red68 avatar image
red68 asked

Convert Postgresql to MS SQL b/c MS SQL does not have "USING" Clause like Oracle.

How would you convert the below to MS SQL Server from Oracle Postgresql.

UPDATEstage_cust_xref s

SET address_customer_id =a.customer_id

,email_customer_id =CASEWHEN s.email_customer_id =0THENa.customer_id ELSE s.email_customer_id END

,phone_customer_id =CASEWHEN s.phone_customer_id =0THENa.customer_id ELSE s.phone_customer_id END

,k1_customer_id =CASEWHEN s.k1_customer_id =0THENa.customer_id ELSE s.k1_customer_id END

FROM(SELECTa.customer_id, s.dw_id, s.hh_id, s.in_id, s.fnln_hh_id, s.fnln_in_id

FROM stage_cust_xref s

JOIN customers a

USING(stage_id))a

WHERE s.address_customer_id =0

AND s.address_match_ind ='Y'

AND s.dw_id =a.dw_id

AND s.hh_id =a.hh_id

AND s.in_id =a.in_id

sql-server-2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.