I want to create a stored procedure to insert data into a table in the database, but it should be unique so I check first for the incoming parameter:
create procedure SP_Insert
@name varchar(50)
AS
if not exists (select Name from Employees where Name = @name)
begin
insert into Employess (Name)
values (@name)
end
My question is, how to tell in my code if the passing parameter hasn't been accepted as a unique value after the execution of the stored procedure?
In my form I have a button (Insert) and a textbox (name), when the user click insert the text value is passed to the stored procedure, and I want to spring a message box warning the user of duplicated entry