If you are looking for a One True Way Of Writing All Insert Procedures, then you're wasting your time. There will always be a table somewhere in your database that requires you to violate your own conventions somehow. The best you can hope for is a set of general consistency guidelines (not rules).
For general consistency guidelines, I suggest the following:
- The return value is always
int
and cannot be changed. Accordingly, it is best reserved for returning zero for success or @@error
for failure.
- Output parameters are more efficient than the default resultset if you have a small collection of scalar values to send back. You can therefore return the
@@identity
value and any other auto-generated values (e.g. GUIDs, timestamps) in this manner.