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 2008 Forums
 Transact-SQL (2008)
 how can i stop to add records if date is....

Author  Topic 

asifbhura
Posting Yak Master

165 Posts

Posted - 2010-10-05 : 07:09:32
Hello

I have two table
1.CourseRegistration

column name: Userid, courseno,roomname

2.course

column name: coursestartdate,courseenddate,courseno etc...

I want that, User cannot register to course if he already registered in between dates of other course

means
I want like,if user registers for course,
for example coursename: sql server

startdate: 10/10/2010
end date:10/11/2010

after registration for this course
if hwe tries to register for another course which startdate or end date must not be inbetween 10/10/2010 and 10/11/2010

Regards,

kunal.mehta
Yak Posting Veteran

83 Posts

Posted - 2010-10-06 : 02:48:26
u need to check if the record exists for the same user in the period specified and if the rowcount in the select query is more than 0 throw exception from the SP
Go to Top of Page
   

- Advertisement -