i need to write a stored procedure which will return a string.logic is
when user try to insert a new record i need to check whether that record already exist.if exist need to return msg "Record exist" else return "Inserted"
following is what i have done for the moment and i'm stuck here.can some one help me to complete the procedure
CREATE PROCEDURE [dbo].[spInsetPurpose]
@Purpose VARCHAR(500),
@Type VARCHAR(6),
@Result VARCHAR(10)= NULL OUTPUT
AS
BEGIN
Declare @Position VARCHAR(20)
DECLARE @TempTable TABLE (Purpose VARCHAR(500))
INSERT INTO @TempTable
SELECT Purpose FROM tblPurpose WHERE Purpose=@Purpose
INSERT INTO tblPurpose(Purpose,[Type]) VALUES(@Purpose,@Type)
END