Equivalence in Sql server syntax

Last post 07-08-2009 4:24 AM by Steelymar. 1 replies.

Sort Posts:

  • Equivalence in Sql server syntax

    07-08-2009, 4:10 AM
    • Contributor
      2,575 point Contributor
    • wmec
    • Member since 12-20-2007, 6:36 AM
    • China
    • Posts 1,591

    Hi,
    How to change such Oracle syntax to Sql server?
    update tab_a a
    set fld_b=amount/(select case when isnull(fld_a,0)=0 then 1 else fld_a end
    from tab_b b
    where a.common_id=b.common_id)

    Many Thanks & Best Regards,
    HuaMin Chen
    (If you mark it then it means the post is helpful/meaningful for other people's reference in the future!)
  • Re: Equivalence in Sql server syntax

    07-08-2009, 4:24 AM
    Answer
    • Star
      8,475 point Star
    • Steelymar
    • Member since 01-28-2009, 4:39 AM
    • Bulgaria
    • Posts 1,252

    update tab_a
    set fld_b=a.amount/case when isnull(fld_a,0)=0 then 1 else fld_a end
    from tab_a a INNER JOIN tab_b b ON a.common_id=b.common_id


    Regards,
    Stefan Uzunov
Page 1 of 1 (2 items)