Home Forums SQL Server 7,2000 T-SQL Convert my syntax - Oracle SQL to MS SQL Server RE: Convert my syntax - Oracle SQL to MS SQL Server

  • No merge statement. You'll have to write seperate update and insert statements. Something like this

    Update table2 set f1 = table1.f2*0.1

    FROM table1 where table2.f1=table1.f1 and table1.f1=20

    INSERT Into table2 (f1, f2)

    SELECT f1, f2*0.05 FROM table1 where not exists (select 1 from table1 where table2.f1=table1.f1 and table2.f2=table1.f1 and f1=20)

    those should be equivalent, but they are untested and I'm not completely familiar with how oracle's merge works

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass