Hi, I am trying to create an upsert for my table, if records exists, update else insert, for a table, anyone knows how to do all in one
i am going in google but its too much information instead of just one small page which shows how it is done in sql server
m
Myka Forrest
01/30/2023, 2:00 PM
What do you mean by "all in one"?
r
rodyon
01/30/2023, 2:16 PM
sql server has no upsert statement, only workarounds
I do this with a try/catch in CF. Run the insert first, if you catch a duplicate error, then do the update. Another try/catch around the update will handle its errors Any other error you handle as you normally would. I typically only do this on the "admin" side of an app where I know the user traffic is low or where the routine is not something that is heavily used