Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Checking for date conflict

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-11-03 : 08:06:21
Kim writes "I was given a ready-made sql database that is an interactive tool for employees to reserve a specific piece of equipment. The problem: there is no procedure for checking if a piece of equipment is already reserved when a new request is made. We need a check at the time of each new request for availability of the equipment. If it is not available at the time requested we need an error message to appear stating such.

The main table (PR_Reservations) consists of the following columns: reservation_id (primary key INT 4) resource_id (INT 4), location (VARCHAR 255), username (VARCHAR 50), start_time (DATETIME 8), end_time (DATETIME 8). The start_time and end_time being the dates and times the equipment is being reserved.

How do I code this?"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-11-03 : 08:15:54
select 'The main table (PR_Reservations) consists of the following columns: reservation_id = ' + convert(varchar(20),reservation_id) + ', resource_id = ' + convert(varchar(20),resource_id) + ', location = ' + location + ', username = ' + username + ', start_time = ' + convert(varchar(8),start_time ,112) + ', end_time = ' + convert(varchar(8),end_time ,112) + ','
from tbl
where reservation_id = @reservation_id

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -