Calling a UDF

  • Hi All

    I'm using SQL Server 2000 SP4.

    I've created a user defined function in my DTS script to convert text to propercase (Title Case). However, when I call the function it runs OK and updates the passed parameter but does not pass the value back to my calling statement.

    What am I doing wrong? Do I need to do this ByRef or similar?

    Help much appreciated, thanks.

    .

    .

    Function Main()

    .

    .

    DTSDestination("Field1") = ProperCase(DTSSource("Field1"))

    Main = DTSTransformStat_OK

    End Function

    Function ProperCase(NewField)

    Dim cVar

    .

    . create cVar as propercase of NewField...

    .

    NewField = cVar

    End Function

  • You need a RETURN clause. Probably specifically, the "NewField = cVar" line should be "RETURN cVar".

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply