views:

19

answers:

1

Hi,

I have to delete some amnt of data and insert some into same table.

Will there be any performance improvement if we go for Upsert in a loop ?

Thanks in advance!

+4  A: 

No. Just use a simple

DELETE ...
INSERT ...

...probably in a transaction too

You can't "UPSERT" in SQL Server 2005. MERGE was added for SQL Server 2008.

A loop is almost never the answer for any query in a database engine

gbn
I am working inn sql server 2008 (I didnt select it bcoz 2008 is not available in the list).
Anish
So, Is merge faster ?
Anish
@Anish: I have no tested but it's probably the same because still has to do the same combined insert/update/delete
gbn

related questions