dbTalk Databases Forums  

Execute SQL Task oddity

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


Discuss Execute SQL Task oddity in the microsoft.public.sqlserver.dts forum.



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

Default Execute SQL Task oddity - 10-14-2004 , 02:44 PM






I am having trouble with an Execute SQL Task in my DTS.

When I create a simple SQL statement as below - the single result count is available as an Output Variable:
SELECT COUNT(*) FROM MYTABLE

However the SQL statement below that returns just one result count, doesn't have any available Output Variables to me. The Query works great in QA:
SELECT COUNT(*)
FROM Audittrail a
JOIN TransactionType tt ON tt.TransactionType = a.TransactionType
JOIN TransactionSession ts ON ts.TransactionSessionID = a.TransactionSessionID
AND ts.TransactionTime BETWEEN CONVERT(Char(10), DATEADD(d, - 1, GETDATE()), 101)
AND CONVERT(Char(16), DATEADD(d, - 1, GETDATE()), 101) + '23:59:59'
LEFT JOIN EventLog e ON a.EventID = e.EventID
WHERE tt.JobCode = 'Enforcement' AND a.Status = 'Failed.'

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

Default Re: Execute SQL Task oddity - 10-14-2004 , 02:52 PM






What happens if you say

SELECT COUNT(*) as Amount
FROM Audittrail a
JOIN TransactionType tt ON tt.TransactionType = a.TransactionType
JOIN TransactionSession ts ON ts.TransactionSessionID =
a.TransactionSessionID
AND ts.TransactionTime BETWEEN CONVERT(Char(10), DATEADD(d, - 1,
GETDATE()), 101)
AND CONVERT(Char(16), DATEADD(d, - 1, GETDATE()), 101) + '23:59:59'
LEFT JOIN EventLog e ON a.EventID = e.EventID
WHERE tt.JobCode = 'Enforcement' AND a.Status = 'Failed.'

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.Konesans.com


"Joe Horton" <horj235 at lni dot wa dot gov> wrote

I am having trouble with an Execute SQL Task in my DTS.

When I create a simple SQL statement as below - the single result count is
available as an Output Variable:
SELECT COUNT(*) FROM MYTABLE

However the SQL statement below that returns just one result count, doesn't
have any available Output Variables to me. The Query works great in QA:
SELECT COUNT(*)
FROM Audittrail a
JOIN TransactionType tt ON tt.TransactionType = a.TransactionType
JOIN TransactionSession ts ON ts.TransactionSessionID =
a.TransactionSessionID
AND ts.TransactionTime BETWEEN CONVERT(Char(10), DATEADD(d, - 1,
GETDATE()), 101)
AND CONVERT(Char(16), DATEADD(d, - 1, GETDATE()), 101) + '23:59:59'
LEFT JOIN EventLog e ON a.EventID = e.EventID
WHERE tt.JobCode = 'Enforcement' AND a.Status = 'Failed.'



Reply With Quote
  #3  
Old   
Joe Horton
 
Posts: n/a

Default Re: Execute SQL Task oddity - 10-14-2004 , 03:08 PM



That approach works well - thanks.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
What happens if you say

SELECT COUNT(*) as Amount
FROM Audittrail a
JOIN TransactionType tt ON tt.TransactionType =
a.TransactionType
JOIN TransactionSession ts ON ts.TransactionSessionID =
a.TransactionSessionID
AND ts.TransactionTime BETWEEN CONVERT(Char(10), DATEADD(d, - 1,
GETDATE()), 101)
AND CONVERT(Char(16), DATEADD(d, - 1, GETDATE()), 101) + '23:59:59'
LEFT JOIN EventLog e ON a.EventID = e.EventID
WHERE tt.JobCode = 'Enforcement' AND a.Status = 'Failed.'

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.Konesans.com


"Joe Horton" <horj235 at lni dot wa dot gov> wrote in message
news:e$Uf3YisEHA.3740 (AT) tk2msftngp13 (DOT) phx.gbl...
I am having trouble with an Execute SQL Task in my DTS.

When I create a simple SQL statement as below - the single result count is
available as an Output Variable:
SELECT COUNT(*) FROM MYTABLE

However the SQL statement below that returns just one result count,
doesn't
have any available Output Variables to me. The Query works great in QA:
SELECT COUNT(*)
FROM Audittrail a
JOIN TransactionType tt ON tt.TransactionType =
a.TransactionType
JOIN TransactionSession ts ON ts.TransactionSessionID =
a.TransactionSessionID
AND ts.TransactionTime BETWEEN CONVERT(Char(10), DATEADD(d, - 1,
GETDATE()), 101)
AND CONVERT(Char(16), DATEADD(d, - 1, GETDATE()), 101) + '23:59:59'
LEFT JOIN EventLog e ON a.EventID = e.EventID
WHERE tt.JobCode = 'Enforcement' AND a.Status = 'Failed.'





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.