Date Operations in Stored Procedure

Date Operations in Stored Procedure

Post by Arun Sollet » Mon, 08 Jan 2001 07:16:55



What i have ?

I table which contains reservation schdules for some given set of Items.
The Reservation schdules will be in the form of Data range i.e. start
date and end date. So i will have 3 field in the database Items, StDate,
EndDate. There can be multiple reservations for a single Item.

Problems ?

I am trying to write a stored operations which gets three input
parameters Item, D1, D2 for placing reservation on Item from D1 to D2.
For this purpose i have to parse through existing reservation scehdules
and verify if the i can reserve the Item between D1 and D2 or will it
overlap with existing schdules.

Result ?

My stored procedure should return OK if there is no overlap otherwise
RESERVED if there is a overlap.

 
 
 

Date Operations in Stored Procedure

Post by DriftWoo » Thu, 11 Jan 2001 01:33:30


If these are actual date columns then simple date arithmetic will work:

if item > d1 and item < d2 then
...

etc.

You can test for overlap by using this in a SQL statement where clause
(without the IF) against the start and end date columns.

--
-cheers
  DW
--------------------------------------------------------------------
"It is a kind of good deed to say well; and yet words are not deeds.
  -William Shakespeare"

Sent via Deja.com
http://www.deja.com/

 
 
 

1. Date Operations in Stored Procedure

What i have ?

I table which contains reservation schdules for some given set of Items.
The Reservation schdules will be in the form of Data range i.e. start
date and end date. So i will have 3 field in the database Items, StDate,
EndDate. There can be multiple reservations for a single Item.

Problems ?

I am trying to write a stored operations which gets three input
parameters Item, D1, D2 for placing reservation on Item from D1 to D2.
For this purpose i have to parse through existing reservation scehdules
and verify if the i can reserve the Item between D1 and D2 or will it
overlap with existing schdules.

Result ?

My stored procedure should return OK if there is no overlap otherwise
RESERVED if there is a overlap.

2. ADODB.Command error '800a0bb9'

3. Stored Procedure : is it possible to retrieve the new Record_ID during an INSERT operation

4. Test

5. VIEW like operation with Stored Procedures?

6. Maximum number of records returned?

7. Execute stored procedures in a set operation

8. SYBASE DBA's DC-MD-VA

9. bit operation in stored procedures

10. Semaphore Locking Operation IN INFORMIX OnLine 7.1 Stored Procedure

11. Calling a Java Stored Procedure from another Java Stored Stored Procedure

12. Stumped...Insert Date with Stored Procedure using .CreateParameter(...)

13. using dates as stored procedure paramaters