Optional parameter in SQL server -


I have a user-defined function that is used in many stored procedures that will give me some value. If it is possible for me to add a new optional parameter

If I do not pass any value, then it should be empty and if I pass some value then it should be taken. I do not want to and do not want to change all stored procedures to do this.

Example code

  dbo.CalculateAverageForUser (userid int)  

do I dbo.CalculateAverageForUser (userid int, type I can use NVARCHAR (10) = NULL)

If you have all your existing Do not want to adjust stored procedures that reference the function, so I think you will need to create a new function with the code from your existing one

< P> Then just change the change; Calculate the Function by EverefaureUser2 (@UsuridInte, Ultimate 2Environment (10) = Faucet) Float AS / Existing Function to Low:

  Calculate the change function. Return to the form of aerior user (@User EAA) float dbo.CalculateAverageForUser2 (@User, Default) END  

Comments