How Do I Add A Function In SQL DTS That I Can Call From other Functions

  • How Do I Add A Function In SQL DTS That I Can Call From other Functions.

    I Have a DTS ACTIVEX Script Program Using VBScript.

    My problem is that i am using a Function that i want to beable to call from different ActiveX Scripts in the same Packet

    Here is the code for the Function I Want to call

    Function CheckForQuote(ByVal sValue As String) As String

    Dim sAns As String

    sAns = Replace(sValue, Chr(39), "''")

    CheckForQuote = sAns

    End Function

    Please Help

    Keith Hinkle

    CBS Technologies

  • DTS doesn't have any concept of "global" code. Looking at the function you've provided, why wouldn't you just use the built-in replace function and do away with the extra function call?

    Anyway, one method, although not the most optimal, and a pain to maintain, is to include the function in each of you're scripts Other methods would consist of possibly putting your library functions in a DLL and calling that from your script. Still a bit painful to get results back and forth. Another method that I've heard implemented, but I've never done myself, is to put your library scripts in a seperate DTS package and dynamically load them into a un-attached ActiveXScript task

     

    --------------------
    Colt 45 - the original point and click interface

  • I could have sworn someone showed an example of such code at SQLPASS in a talk on DTS best practices.  Anyone remember that?

    Larry

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

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