Author: mcru | Posted on: 11/18/2008 11:42:25 AM | Views : 305

I've got a query that I need to put in a SqlDataSource. The query is an "upsert", it tries to update a row, but if the update returns 0 rows an insert statement runs instead.
 Here is my query:
update        Export                                          --Always executes it will not update if not exists which will return a ROWCOUNT of 0
set            profileID = (select profileID from [Profile] where profileName = @profileName)
where        storeID = @storeID           
IF @@ROWCOUNT = 0
BEGIN
insert        Export (profileID, storeID)                &nbs ...

Go to the complete details ...