dbTalk Databases Forums  

The correct logic

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


Discuss The correct logic in the microsoft.public.sqlserver.dts forum.



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

Default The correct logic - 12-24-2008 , 04:11 AM






Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #2  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM






You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #3  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #4  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #5  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #6  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #7  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #8  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



Reply With Quote
  #9  
Old   
Tom Moreau
 
Posts: n/a

Default Re: The correct logic - 12-24-2008 , 06:30 AM



You can use conditional logic in SSIS. For example, your Execute SQL task
could set a value to 0 or 1 based on your SELECT. Then create a precedence
constraint from the Execute SQL task to the next task. Edit the precedence
constraint to use evaluation operation 'Expression and constraint'; Value
'success' and write the expression like @[User::RecentData]==1.
--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Abba" <SQL_Help (AT) aaa (DOT) com> wrote

Hello,

[SQL2000]

Iam syncing data from PROD to BETA using an SSIS package. After I load the
data to stage table from PROD, I compare the dates between stage and load
table. If the stage table only has latest data then only I need the rest of
the steps in the package to be executed.

So, in my SQL Execute task, I write:

IF EXISTS(SELECT 1 FROM Stage WHERE upd_date <= (SELECT MAX(upd_date) FROM
load))
BEGIN

RAISERROR('There is no recent data in PROD', 11, 1)

END

This works fine as it errors out when we dont have latest PROD data, but
then the scheduled job that runs the SSIS package always completes as
'failed'. How can I change the query or logic to accomplish what I want?


TIA,
AbbA



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.