dbTalk Databases Forums  

Use global variable to update a table

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Use global variable to update a table in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
txksa
 
Posts: n/a

Default Use global variable to update a table - 12-27-2005 , 03:41 PM






In part of a DTS package a user will input a value. I need to take that
value and update a table. Something along the lines of

"UPDATE dbo.OLSParms" & _
" SET dbo.OLSParms.Val = '" & DTSGlobalVariables("Category").Value & "'"

From within the activex script task, how would I write this?

Reply With Quote
  #2  
Old   
jariwala_b@rediffmail.com
 
Posts: n/a

Default Re: Use global variable to update a table - 12-27-2005 , 11:07 PM






you can use inputBox function and catch user input to DTSGlobalVariables("Category").Value.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...

Reply With Quote
  #3  
Old   
txksa
 
Posts: n/a

Default Re: Use global variable to update a table - 12-28-2005 , 10:23 AM



I am currently using an inputbox to do this. I am new to this kind of stuff.
I am trying to actually figure out how to execute a sql string within the
activex script task.

"Bharat Jariwala" wrote:

Quote:
you can use inputBox function and catch user input to DTSGlobalVariables("Category").Value.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...


Reply With Quote
  #4  
Old   
txksa
 
Posts: n/a

Default Re: Use global variable to update a table - 12-28-2005 , 03:42 PM



I just was not understanding exactly how this worked before. I have since
worked throught the problem.

Function Main()
'Get Category Information
'DTSGlobalVariables("Category").Value

'Get TimeID Information
'DTSGlobalVariables("TimeID").Value
Dim oPkg, oDataPump, sSQLStatementCat, sSQLStatementTime

' Build new SQL Statement
sSQLStatementCat = "UPDATE dbo.OLS_Parms " & _
"SET dbo.OLS_Parms.Val = '" & DTSGlobalVariables("Category").Value & "' "
& _
"WHERE dbo.OLS_Parms.Parm = 'CrossAppCategory'"

' Get reference to the Exec SQL Task
Set oPkg = DTSGlobalVariables.Parent
Set oExecSQL = oPkg.Tasks("DTSTask_DTSExecuteSQLTask_1").CustomTa sk

' Assign SQL Statement to Exec SQL Task
oExecSQL.SQLStatement = sSQLStatementCat

' Clean Up
Set oExecSQL = Nothing
Set oPkg = Nothing

Main = DTSTaskExecResult_Success
End Function

Now here is my new question......
When I run this DTS package from within a SQL Job, why doesn't the input box
display?

"txksa" wrote:

Quote:
I am currently using an inputbox to do this. I am new to this kind of stuff.
I am trying to actually figure out how to execute a sql string within the
activex script task.

"Bharat Jariwala" wrote:

you can use inputBox function and catch user input to DTSGlobalVariables("Category").Value.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...


Reply With Quote
  #5  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Use global variable to update a table - 01-03-2006 , 04:25 PM



Hello txksa,

It would be much better if the user deposited this value in a place that
the package could pick up rather than the package halting execution whilst
it waits for the user to enter a value.


Allan



Quote:
In part of a DTS package a user will input a value. I need to take
that value and update a table. Something along the lines of

"UPDATE dbo.OLSParms" & _
" SET dbo.OLSParms.Val = '" & DTSGlobalVariables("Category").Value &
"'"
From within the activex script task, how would I write this?




Reply With Quote
  #6  
Old   
txksa
 
Posts: n/a

Default Re: Use global variable to update a table - 01-04-2006 , 08:58 AM



I realized that after the fact. I have since corrected. Thank you for your
input!

"Allan Mitchell" wrote:

Quote:
Hello txksa,

It would be much better if the user deposited this value in a place that
the package could pick up rather than the package halting execution whilst
it waits for the user to enter a value.


Allan



In part of a DTS package a user will input a value. I need to take
that value and update a table. Something along the lines of

"UPDATE dbo.OLSParms" & _
" SET dbo.OLSParms.Val = '" & DTSGlobalVariables("Category").Value &
"'"
From within the activex script task, how would I write this?





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.