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

  • Absolutely, yes. Cursors are massively inefficient.

    Again this is untested, but I think it should do the same as the cursor. I'd be very interested in how long it runs.

    UPDATE

    table2 SET c = CAST(table1.c AS VARCHAR(255))

    FROM table1 WHERE table1.a = table2.a and table1.b=table2.b

    btw, if you have tables with 10 million + rows with no indexes, you're going to have terrible performance. Is there anyone you can speak to about putting indexes on these tables? Not for this, but for all your other queries

    Also, you said about copying the values of column c from table2 into table1, but your code has it the other way round.

    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