Declare in pass-thru

J

JasRain

The following works in SQL 2000 but returns a message stating "Pass-Thru
query with ReturnsRecords property set to True did not return any records"
Any idea why?

DECLARE @MyMonth VARCHAR(2)

IF Month(GetDate())-1 = 0
Set @MyMonth = '12'
ELSE
Set @MyMonth = MONTH(GETDATE())-1

Select
RTRIM(C.Description) as FacName,
RTRIM(E.EmployeeNum) as EmployeeNum,
E.RIFDate = '1901-01-01'
ET.TerminateSecurityDate

FROM Employee E
LEFT JOIN Company C
ON E.FacilityID = C.FacilityID
LEFT JOIN EmpTermination ET
ON E.FacilityID = ET.FacilityID AND
E.SSN = ET.SSN

Where
(Month(E.RifDate) = @MyMonth OR
month(ET.TerminateSecurityDate) = @MyMonth)
AND E.ASTTAITValue <> 'T'

Order By E.FacilityID, E.SSN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top