Yesterday I had to add a much needed parameter to a SQL Server 2005 user-defined function (or UDF). The catch was that the current version of the UDF (i.e. the version without the parameter) was already being used in production by a few SQL queries. Not wanting to break those existing queries, I decided to assign a sensible default value to the new parameter. With a default value I figured I could add the parameter to the UDF without having to modify existing calls to the UDF.
Boy was I wrong. …Continue reading » How to Use Default Parameters in User Defined Functions in SQL Server 2005







