December 28, 2011 at 9:16 am
Hi, I have an aggregate function which is using external DLL. The function looks like below
CREATE AGGREGATE [dbo].[ABCDEF](@var [int], @var2 [int])
RETURNS[int]
EXTERNAL NAME [WBA].[Zebra.VAR.SqlServer.VID.PERC]
GO
My question is, Is there anyway we can pass values into the parameters, like I want default value for @var2 as 50 always. Is this possible?
THanks
December 28, 2011 at 9:27 am
If you try to add a default in your create your will receive an error "Msg 10726, Level 15, State 1, Line 1
User defined aggregates do not support default parameters.". I was having a hard time finding anywhere in bol that discusses parameter defaults for user defined aggregates.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 28, 2011 at 9:34 am
yeah. May be I should try passing the variable in the DLL itself.
Thanks for the quick reply.
December 28, 2011 at 9:39 am
If you have access to modify the dll you could probably make some value be your null/default. Something like -42 or some other value that is not possible during normal operations. Then you just add an if condition in your assembly. Not the most elegant solution but it should work.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply