this is the stired procedure i have used to check if an username already exists in the database or not. so far duplicate values are not stored in the database,but i need to display an output that says "this username already exists".can somebody tell me how ?
ALTER proc db_ins1(@username nvarchar(50),@dob nvarchar(max),@sex nvarchar(50),@password nvarchar(50),@email nvarchar(50))
as
if EXISTS(select 'true' from reg1 where username=@username)
begin
select 'this user already exists!!'
end
else
begin
insert into reg1 values(@username,@dob,@sex,@password,@email);
select' record added'
end