Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NULL result / correct result

Status
Not open for further replies.

zalx

Programmer
Joined
Dec 3, 2001
Messages
1
Location
RO
I've written a stored procedure that searches through a table containing
attendance actions. One employee can have more cards.

The problem is that I run the procedure and sometimes it returns null,
othertimes it runs correctly. I've isolated the problem around the next
statement:

SELECT Action.actionTypeId FROM Action inner join Card on action.cardID =
Card.cardID

WHERE card.empID= @spp_empId and Action.actionTypeId in (3, 4, 5, 6, 7, 8,
9, 13, 30) and @spp_date between Action.attnIn and isnull( Action.attnOut,
Action.attnIn)

ORDER BY Action.actIn

I run the querry and returns an actionTypeId, and then I run it again and it
returns NULL! When I change one of the params to X and then back to the
original value, it's not NULL again!

This happens in a 10 second interval, no other user on the SQL server, and
this is true for MS SQL Server 7.0 with and without service packs, and for
MSDE 7.0 too.

Thank you in advance,
Alexandru
 
The comparision b/w a null and null would return a null so go make a check if any of the values you are passing has been initialsed to null somewhere in the query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top