Using DTSGlobalVariables directly from T-SQL commands and calls

  • I wish to create a global variable either by entering it on the global variable tab or thru a VB ActiveX script....  from here on in... I want to access and use as a T-SQL variable the DTS global variable... I wish to use the variable directly from T-SQL code and T-SQL (Version: SQL Server 2000) available commands and calls.  No intermediaries (T-SQL run from VB, ActiveX, etc.)....  How is it done?

  • Research using parameters with Stored-Procedures in DTS.  You create the global variable and then in the Execute SQL task add parameter(s) as ?

    Then add the parameter(s) in order on the parameter tab.

    I think this will only work for stored-procedures.

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • I understand... but it doesn't answer the question...  Let's say I have created a DTSGlobalVariable called "MyVariable" and it contains a varchar with the value of "ShoeFly"... Now I wish to execute a T-SQL command from a T-SQL DTS task and I wish to say???

    select count(*) from My_Table where Table_Column = DTSGlobalVariable.MyVariable  ?????

    Remember no VB, ActiveX or anything else except T-SQL statements, commands, and calls...

    And the reverse is also needed...

    Declare DTSGlobalVariable.MyVariable     VARCHAR(132) ?????

    Set DTSGlobalVariable.MyVariable = 'HorseFly'  ?????

    again... no VB, ActiveX or anything else except T-SQL statements, commands, and calls...

    How is it from done from T-SQL statements, commands, and calls only???  I have no care to write VB or ActiveX anything....  

  • You cant without using an ActiveX or Dynamic Properties object.  You would then have to use the above information for the parameter for the stored-procedure.

    Without using the DTS objects I dont think you will be able to perform your desired result



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Hi,

    Here is a nice example in how to use GV.

    http://www.sqldts.com/default.aspx?205

    Regards

    JFB

Viewing 5 posts - 1 through 4 (of 4 total)

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