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
 General SQL Server Forums
 Database Design and Application Architecture
 SQL Procedure to return text string on fail??

Author  Topic 

ChrisjBrown
Starting Member

8 Posts

Posted - 2014-05-25 : 16:18:05

HI,

I have an SQL procedure which enables a user to easily insert records into my database. The code is given below:

CREATE PROCEDURE add_enrollment (IN s_id CHAR(4), IN c_code CHAR(2), e_date DATE)
BEGIN
INSERT INTO enrollment
VALUES (s_id, c_code, e_date);
END

The procedure enables the user to add a new record to the enrollment table; student_id, course_code and enrollment_date and it works. However, what I also need it to do is have an output parameter return a string of text identifying the reason(s) for any failure. I am relatively new to SQL so I am a bit at a loss. Could anyone help?
   

- Advertisement -