dbTalk Databases Forums  

Accessing Global ariables from "Execute SQL Task"

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


Discuss Accessing Global ariables from "Execute SQL Task" in the microsoft.public.sqlserver.dts forum.



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

Default Accessing Global ariables from "Execute SQL Task" - 08-05-2004 , 03:53 AM






Hello,
I am trying to create a program flow using DTS. Though I can achive the same thng using SP and a job but want to use DTS.Here is my question

I am connecting a global variable as @Rowcnt and running the following query to intialize that
SELECT
COUNT(*) AS ROW_COUNT
FROM
S_ORG_EXT_FNX (NOLOCK)
WHERE
LAST_UPD > ?
AND LAST_UPD <= ?

I am creating a output variable @Rowcnt int and assigning ROW_CNT to it. AFter this step succeeds, I want to go to next step and run the following query.

IF @Rowcnt > 0

TRUNCATE TABLE UA_TS_CMS_SELLER_STAGING

When I am running the query it says: "Must declare Variable @Rowcnt".

Basically I want to know how can I access the global variable, programmtically like if ..else, while statements in a SQL Task in DTS Designer.

Thanks in advance

SK



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

Default Re: Accessing Global ariables from "Execute SQL Task" - 08-07-2004 , 03:18 AM






In an Active Script task you can use Workflow

if Cint(DTSGlobalVariables("Rpw_Count").Value) > 0
'Enable the TRUNCATE step
Else
'Disable the TRUNCATE step
End If



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"SK" <SK (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello,
I am trying to create a program flow using DTS. Though I can
achive the same thng using SP and a job but want to use DTS.Here is my
question
Quote:
I am connecting a global variable as @Rowcnt and running the following
query to intialize that
SELECT
COUNT(*) AS ROW_COUNT
FROM
S_ORG_EXT_FNX (NOLOCK)
WHERE
LAST_UPD > ?
AND LAST_UPD <= ?

I am creating a output variable @Rowcnt int and assigning ROW_CNT to it.
AFter this step succeeds, I want to go to next step and run the following
query.
Quote:
IF @Rowcnt > 0

TRUNCATE TABLE UA_TS_CMS_SELLER_STAGING

When I am running the query it says: "Must declare Variable @Rowcnt".

Basically I want to know how can I access the global variable,
programmtically like if ..else, while statements in a SQL Task in DTS
Designer.
Quote:
Thanks in advance

SK





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.