Ok thanks guys. I appreciate how difficult this is for you without
having the code but you are helping.
I can now get the code to work in query analyser using DMAC's stuff
below.
However i need to call this function as part of a DTS package inside a
Transform Data Task, that's where the activex package comes in Erland.
Written in VBScript.
When I try to run/execute/call it I get error code:0; vbscript runtime
error; Type Mismatch: functionanme.
Now my impression was that it has something to do with datatypes. So I
explicitly set the date fields using cdate and the varchar fields
using cstr but I still get the error.
I'm still trying to call it by using...
variable name = functionname(var1, var2 ...var6)
Am I missing the boat here, can it be done and if not can someone shed
some light on the best way to use a UDF like this inside a data
transformation task.
Thanks again guys.
On 15 Sep 2003 16:03:47 -0700,
dr***@drmcl.free-online.co.uk (DMAC)
wrote:
CREATE FUNCTION fnTEST
(@param1 int, @param2 int)
RETURNS int
AS
BEGIN
DECLARE @sum AS int
SELECT @sum = @param1 + @param2
RETURN @sum
END
go
declare @ReturnVariable int
select @ReturnVariable=dbo.fntest(1,1)
select @ReturnVariable
Not surprisingly this will disply 2 in query analyser, but it does
serve the point of displaying how to assign a functions return value
to a variable.