Separate stored procedures for inserts and updates?
5
votes
2
answers
18804
views
I have a table in Microsoft SQL Server. Sometimes I need to update, and sometimes I need to insert. I could write 2 stored procedures:
InsertNewPerson
UpdatePertsonById
But I was thinking to write 1 stored procedure instead (
SetPerson
) which would do both (if there is an ID
, it is an update
operation , else insert
).
Should I create one stored procedure (only one to maintain) or should I create two different stored procedures?
Asked by Royi Namir
(1233 rep)
Dec 4, 2012, 08:03 AM
Last activity: May 15, 2020, 02:01 AM
Last activity: May 15, 2020, 02:01 AM