Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Aerathi
Starting Member
14 Posts |
Posted - 2005-08-26 : 11:34:35
|
| I was wondering if it's possible to have optional parameters in a sql udf. This is basically my function header:CREATE FUNCTION [dbo].[FUNC_ParseOptionalParam]( @ParamName VarChar(4000), @ParamString VarChar(4000), @ParamDelimiter VarChar(2) = '||', --Seperates each name/value pair from one another @ValueDelimiter VarChar(2) = '::' --Seperates a particular parameter from it's corresponding value)When I try to call the function without specifically setting the two Delimiters, I get a not enough parameters error. My end goal is to have a string list of delimited named value pairs which will serve as optional parameters for a stored procedure. Everything works, I would just really like the delimiters to be changable, if the need should arise. |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2005-08-26 : 12:07:13
|
Hi You can use defaults, but you have to pass in the keyword 'default' in place of a parameter value. I.e.SELECT dbo.udfMyFunction('a', 'b', DEFAULT)Mark |
 |
|
|
|
|
|