I have a stored procedure that has a bunch of input and output parameters because it is Inserting values to multiple tables. In some cases the stored proc only inserts to a single table (depending on the input parameters). Here is a mocked up scenario to illustrate.
Tables / Data Objects:
Id Name Address
Id FirstName LastName
Id Country City
Say I have a stored procedure that inserts a person. If the address doesn't exist I won't add it to the
Address table in the database.
Thus when I generate the code to call the stored procedure I don't want to bother adding the
Address parameter. For
INPUT parameters this is ok because SQL Server allows me to supply default values. But for the
OUTPUT parameter what do I do in the stored procedure to make it optional so I do not receive an error…
Procedure or function 'Person_InsertPerson' expects parameter
'@AddressId', which was not supplied.