Cursor vs Set - is it possible
From: Steve Z (szlamany_at_antarescomputing.com)
Date: 04/06/04
- Next message: mannie: "sp_dropserver sp_addserver local changed all my passwords."
- Previous message: Sue Hoegemeier: "Re: xp_cmdshell right for non sysadmin"
- Next in thread: keene: "Re: Cursor vs Set - is it possible"
- Reply: keene: "Re: Cursor vs Set - is it possible"
- Reply: Adam Machanic: "Re: Cursor vs Set - is it possible"
- Reply: Hugo Kornelis: "Re: Cursor vs Set - is it possible"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 6 Apr 2004 12:36:05 -0700
I always try to use a SELECT and avoid CURSOR logic - whenever possible - but this time I can't even think of a way to SET-base this operation.
I've got a table that stores dates of ATTENDANCE. Only non-present dates have rows for a person.
ABSENT on 04/02/2004 gets a row for a person - ABSENT again on 04/07/2004 gets a row for a person.
I want to create a UDF that returns the "consecutive number" of ABSENT entries in this table for a person, based on a starting date and going backwards.
I could simply loop a working variable with a date and do a SELECT to see if a record exists - then decrement the date by one day and check again - that was the way we did it on the mainframe VAX we are converting from...
BTW - weekends and holidays are ignored - they don't break the CONSECUTIVE counter...
Any help would be greatly appreciated...
- Next message: mannie: "sp_dropserver sp_addserver local changed all my passwords."
- Previous message: Sue Hoegemeier: "Re: xp_cmdshell right for non sysadmin"
- Next in thread: keene: "Re: Cursor vs Set - is it possible"
- Reply: keene: "Re: Cursor vs Set - is it possible"
- Reply: Adam Machanic: "Re: Cursor vs Set - is it possible"
- Reply: Hugo Kornelis: "Re: Cursor vs Set - is it possible"
- Messages sorted by: [ date ] [ thread ]