Jump to content

Need help to make a trigger in SQL server to display error message if the user inputs a ID that does not exist

im making a hospital database and i need to make a trigger to the department table.the doctor id is a foreign key in department table. if the user inputs a Doctor ID to the department table that does not exist in doctor table, a trigger should execute and display a error message. can someone please help me to get this running.Thank you

Link to comment
Share on other sites

Link to post
Share on other sites

you dont need a trigger. you just need to request if the id exists after the value has been entered

             ☼

ψ ︿_____︿_ψ_   

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×