dbTalk Databases Forums  

DTS issue....please help!!

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


Discuss DTS issue....please help!! in the microsoft.public.sqlserver.dts forum.



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

Default DTS issue....please help!! - 08-03-2005 , 01:15 PM






I have a stored procedure that does a qc check on 2 tables. It contains a
case statement that checks to see if a value falls in a certain range. If it
does it returns a success message, if it fails it returns a failure message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter which
returns the result of the case statement. I run this in Query Analyzer and I
get the desired result. When I put this into a DTS package and have the
output assigned to a Global Variable in the package, the variable comes up as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but not in
DTS. If I alter the stored procedure and replace the select statements with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the desired
result. Why is the DTS pacakge behaving this way? Has anybody else ran into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and DTS is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure this out.

Thanks!!!

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

Default Re: DTS issue....please help!! - 08-03-2005 , 01:54 PM






Have you followed this article?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

also have you set

SET NOCOUNT ON

at the top of the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


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

Quote:
I have a stored procedure that does a qc check on 2 tables. It contains a
case statement that checks to see if a value falls in a certain range. If
it
does it returns a success message, if it fails it returns a failure
message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter which
returns the result of the case statement. I run this in Query Analyzer
and I
get the desired result. When I put this into a DTS package and have the
output assigned to a Global Variable in the package, the variable comes up
as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but not in
DTS. If I alter the stored procedure and replace the select statements
with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the
desired
result. Why is the DTS pacakge behaving this way? Has anybody else ran
into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and DTS is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure this
out.

Thanks!!!



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

Default Re: DTS issue....please help!! - 08-03-2005 , 02:16 PM



Yes I have nocount on. Also the DTS package correctly assings a value to the
global variable if I hard code numbers into my case statement, as shown in my
original post. If I keep the select statements in there then it does not
output a value to the global variable. The behavior I am getting is very
odd. I have had co-workers look at it and they are just as lost as I am.

"Allan Mitchell" wrote:

Quote:
Have you followed this article?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

also have you set

SET NOCOUNT ON

at the top of the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:8D4890B4-3D68-4257-9FCD-CEEFD31D4E76 (AT) microsoft (DOT) com...
I have a stored procedure that does a qc check on 2 tables. It contains a
case statement that checks to see if a value falls in a certain range. If
it
does it returns a success message, if it fails it returns a failure
message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter which
returns the result of the case statement. I run this in Query Analyzer
and I
get the desired result. When I put this into a DTS package and have the
output assigned to a Global Variable in the package, the variable comes up
as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but not in
DTS. If I alter the stored procedure and replace the select statements
with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the
desired
result. Why is the DTS pacakge behaving this way? Has anybody else ran
into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and DTS is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure this
out.

Thanks!!!




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

Default Re: DTS issue....please help!! - 08-03-2005 , 02:28 PM



Can you build up the statement and see where the output value gets lost
eventually?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


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

Quote:
Yes I have nocount on. Also the DTS package correctly assings a value to
the
global variable if I hard code numbers into my case statement, as shown in
my
original post. If I keep the select statements in there then it does not
output a value to the global variable. The behavior I am getting is very
odd. I have had co-workers look at it and they are just as lost as I am.

"Allan Mitchell" wrote:

Have you followed this article?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

also have you set

SET NOCOUNT ON

at the top of the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:8D4890B4-3D68-4257-9FCD-CEEFD31D4E76 (AT) microsoft (DOT) com...
I have a stored procedure that does a qc check on 2 tables. It contains
a
case statement that checks to see if a value falls in a certain range.
If
it
does it returns a success message, if it fails it returns a failure
message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter which
returns the result of the case statement. I run this in Query Analyzer
and I
get the desired result. When I put this into a DTS package and have
the
output assigned to a Global Variable in the package, the variable comes
up
as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but not
in
DTS. If I alter the stored procedure and replace the select statements
with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the
desired
result. Why is the DTS pacakge behaving this way? Has anybody else
ran
into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and DTS
is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure
this
out.

Thanks!!!






Reply With Quote
  #5  
Old   
Andy
 
Posts: n/a

Default Re: DTS issue....please help!! - 08-03-2005 , 03:25 PM



It appears it does not like the sum function. If I run this

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT 5000000 - COUNT(*) * .99 FROM TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT 5000000 + COUNT(*) * .99 FROM TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END


It works, but if I run this

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'') BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END

it doesn't work. It looks the only difference is I took out the
Sum(FORIGAMOUNT) and put a hard coded number in there.





"Allan Mitchell" wrote:

Quote:
Can you build up the statement and see where the output value gets lost
eventually?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:4344F555-CC65-4BF1-8F96-DAC99DAC38E7 (AT) microsoft (DOT) com...
Yes I have nocount on. Also the DTS package correctly assings a value to
the
global variable if I hard code numbers into my case statement, as shown in
my
original post. If I keep the select statements in there then it does not
output a value to the global variable. The behavior I am getting is very
odd. I have had co-workers look at it and they are just as lost as I am.

"Allan Mitchell" wrote:

Have you followed this article?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

also have you set

SET NOCOUNT ON

at the top of the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:8D4890B4-3D68-4257-9FCD-CEEFD31D4E76 (AT) microsoft (DOT) com...
I have a stored procedure that does a qc check on 2 tables. It contains
a
case statement that checks to see if a value falls in a certain range.
If
it
does it returns a success message, if it fails it returns a failure
message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter which
returns the result of the case statement. I run this in Query Analyzer
and I
get the desired result. When I put this into a DTS package and have
the
output assigned to a Global Variable in the package, the variable comes
up
as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but not
in
DTS. If I alter the stored procedure and replace the select statements
with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the
desired
result. Why is the DTS pacakge behaving this way? Has anybody else
ran
into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and DTS
is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure
this
out.

Thanks!!!







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

Default Re: DTS issue....please help!! - 08-03-2005 , 03:29 PM



OK So can you not calculate things up front and present a less sophisticated
rowset to the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


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

Quote:
It appears it does not like the sum function. If I run this

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT 5000000 - COUNT(*) * .99 FROM TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT 5000000 + COUNT(*) * .99 FROM TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END


It works, but if I run this

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'') BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END

it doesn't work. It looks the only difference is I took out the
Sum(FORIGAMOUNT) and put a hard coded number in there.





"Allan Mitchell" wrote:

Can you build up the statement and see where the output value gets lost
eventually?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:4344F555-CC65-4BF1-8F96-DAC99DAC38E7 (AT) microsoft (DOT) com...
Yes I have nocount on. Also the DTS package correctly assings a value
to
the
global variable if I hard code numbers into my case statement, as shown
in
my
original post. If I keep the select statements in there then it does
not
output a value to the global variable. The behavior I am getting is
very
odd. I have had co-workers look at it and they are just as lost as I
am.

"Allan Mitchell" wrote:

Have you followed this article?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

also have you set

SET NOCOUNT ON

at the top of the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:8D4890B4-3D68-4257-9FCD-CEEFD31D4E76 (AT) microsoft (DOT) com...
I have a stored procedure that does a qc check on 2 tables. It
contains
a
case statement that checks to see if a value falls in a certain
range.
If
it
does it returns a success message, if it fails it returns a failure
message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter
which
returns the result of the case statement. I run this in Query
Analyzer
and I
get the desired result. When I put this into a DTS package and have
the
output assigned to a Global Variable in the package, the variable
comes
up
as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but
not
in
DTS. If I alter the stored procedure and replace the select
statements
with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the
desired
result. Why is the DTS pacakge behaving this way? Has anybody else
ran
into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and
DTS
is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure
this
out.

Thanks!!!









Reply With Quote
  #7  
Old   
Andy
 
Posts: n/a

Default Re: DTS issue....please help!! - 08-03-2005 , 05:28 PM



That was my next step. I tried created a variable first and passing it into
the sql statement and it still failed. I have no idea why. Thanks for your
help on this though.

"Allan Mitchell" wrote:

Quote:
OK So can you not calculate things up front and present a less sophisticated
rowset to the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:13CCC51A-A957-47B6-A520-F462C9D28643 (AT) microsoft (DOT) com...
It appears it does not like the sum function. If I run this

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT 5000000 - COUNT(*) * .99 FROM TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT 5000000 + COUNT(*) * .99 FROM TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END


It works, but if I run this

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'') BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on TBL_CBDECISIONINFO_ADRP''
END

it doesn't work. It looks the only difference is I took out the
Sum(FORIGAMOUNT) and put a hard coded number in there.





"Allan Mitchell" wrote:

Can you build up the statement and see where the output value gets lost
eventually?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:4344F555-CC65-4BF1-8F96-DAC99DAC38E7 (AT) microsoft (DOT) com...
Yes I have nocount on. Also the DTS package correctly assings a value
to
the
global variable if I hard code numbers into my case statement, as shown
in
my
original post. If I keep the select statements in there then it does
not
output a value to the global variable. The behavior I am getting is
very
odd. I have had co-workers look at it and they are just as lost as I
am.

"Allan Mitchell" wrote:

Have you followed this article?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

also have you set

SET NOCOUNT ON

at the top of the proc?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:8D4890B4-3D68-4257-9FCD-CEEFD31D4E76 (AT) microsoft (DOT) com...
I have a stored procedure that does a qc check on 2 tables. It
contains
a
case statement that checks to see if a value falls in a certain
range.
If
it
does it returns a success message, if it fails it returns a failure
message.
The code is below

Select Case When
((SELECT SUM_KEY_FIELD FROM tbl_QC_Verify WHERE [FILE_NAME] =
''ADRP_DECISIONED'' ) BETWEEN
( SELECT SUM(FORIGAMOUNT) - COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ) AND
( SELECT SUM(FORIGAMOUNT) + COUNT(*) * .99 FROM
TBL_CBDECISIONINFO_ADRP_STAGE ))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
END)


This is not the whole procedure, but I have an output parameter
which
returns the result of the case statement. I run this in Query
Analyzer
and I
get the desired result. When I put this into a DTS package and have
the
output assigned to a Global Variable in the package, the variable
comes
up
as
non displayable.

The confusing part is this. It works fine in Query Analyzer, but
not
in
DTS. If I alter the stored procedure and replace the select
statements
with
numbers so I basically have

Select Case When
((5 ) BETWEEN
(10) AND
( 2))
THEN ''QCVerify Complete for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
ELSE ''QCVerify Failed for Sum Comparison on
TBL_CBDECISIONINFO_ADRP''
END)

If I run this in DTS now, the global variable is populated with the
desired
result. Why is the DTS pacakge behaving this way? Has anybody else
ran
into
this kind of problem?

The code I am using to run the procedure in both Query Analyzer and
DTS
is

Declare @QCStatus VarChar(8000)
EXEC usp_QCVerify @QCStatus output
select @QCStatus As QCStatus

Any help is appreciated as I have spent many hours trying to figure
this
out.

Thanks!!!










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.