Check before insert data into sql
Hi,
Am creating an application that hold information about trainees and there progress. I have a table that holds the total amount of points a trainee has. A teacher can update the trainees info by selecting the course the trainee has followed only i need to build in a error handeling that checks if the teacher insn't inserting dubble values.
Example in T-sql:
insert into dbo.StudyPoints (Study_uno, Points, Type, Gedoceerd, CrsDate, Trainee_uno)
Select Study_uno, 3, Type, 'Y', '27-10-2004', (Select Trainee_uno from Trainees where lastname like '%Pietje%' and Firstname like '%Puk%') from Course where name like '%Test A%'
but before i do this insert i need to check if the all ready is something in the database with these values...cann some one tell me how??
Regards,
Martijn
|