Insertion / Updation of rows

  • Hi ALL,

    I want to insert rows into a table, say table emp which has primary key empid.

    If empid is already  present it should update..otherwise insert. Something like MERGE command in Oracle.

    Which is the best way to implement the baove functionality ?

    Regards,

    Rajesh

     

  • You can create trigger for inserting.

  • I would use a stored procedure - pass the empID (& other values) as parameters...

    & then do an

    
    if exists(select * from myTable where empID = @empID)
            update.....
    else
            insert into...
    







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply