August 1, 2007 at 7:06 am
Hi All!
I have written a Table-Valued Function say GetMonthName. This Functions has one parameter. When I pass a value in this function, its working fine but when I pass multivalued parameter then its showing an error message:
Procedure or function dbo.DCBL_GetMonthName has too many arguments specified.
How I can handle this problem?
Thanks in advance...
Hari
August 1, 2007 at 7:40 am
By only passing the correct number of arguments?
Not excatly sure what you are saying, but if you have a function declared like :
create function dbo.fcn_test @input int
then you can only call that with one variable. If this is not what you meant please give example of the create function statement and how you call it when you get the error.
August 1, 2007 at 8:25 pm
PLEASE! If you want help, post the offending query that gave you the error!
--Jeff Moden
Change is inevitable... Change for the better is not.
August 1, 2007 at 11:27 pm
OK guys!
Here I'll explain my problem with an example:
I created following function:
CREATE
Function [dbo].[GetSplitedValues]
(
@CommaSeparatedString
varchar(8000)
)
RETURNS
@Table Table (ID int)
Begin
Declare @TempStr varchar(8000)
Set @TempStr = @CommaSeparatedString + ','
While Len(@TempStr) > 0
Begin
Insert Into @Table Select SubString(@TempStr,1,CharIndex(',',@TempStr)-1)
Set @TempStr = Right(@TempStr,Len(@TempStr)-CharIndex(',',@TempStr))
End
Return
End
When I run this function in Query Analyzer, its working fine. But when I call this function in Reporting Services 2005 to create a DataSet, its raising an error.
Example: Select ID From dbo.GetSplitedValues(@State)
Here @State is Multi-Valued Parameter and it may have string like '1,2,3' or '1,4,6,9,10' on the basis of values selected in the parameter list. So when this parameter is passed into the function the values are treated as 1,2,3 instead of '1,2,3' or 1,4,6,9,10 instead of '1,4,6,9,10'. Thats why its raising an error. How can I solve this problem.......??????????
August 1, 2007 at 11:52 pm
I don't think anybody could have guessed what you meant from your original post.
Anyway, the problem is not in SQL.
Your front end progrm should add the surrounding quotes.
August 2, 2007 at 8:23 am
Hari... are you calling the function using SQL that's embedded in the GUI code? If so, Koji is absolutely correct... the code must add the outer quotes as part of the code. Post the call if you'd like...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 4, 2007 at 9:12 am
I am experiencing the same problem. When you mention "Front End Code" are you talking about the code created thru Report services. If so, where in the code do I need to add the quotes?
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply