posted on Tuesday, August 05, 2008 4:12 PM |

A friend of mine asked me a question regarding SQL and default parameters.

Here is what he ran into:

create function foo
(
      @required int, 
      @optional int = 0
)
returns int
as
begin
      return(select @required)
end
go

But if he ran it with this:

select [dbo].foo(2)

He would get an error saying insufficient number of arguments where passed in.  Here is what he should have done:

select [dbo].ff(2, DEFAULT)
Tags [ Coding ]

Your Comments.

No comments posted yet.

Post Comment
Title *
Name *
Email
Url
Comment *  
Please add 8 and 8 and type the answer here: