Monday, May 16, 2011

Check username if it exist in database through stored procedure

THIS IS DONE THROUGH STORED PROCEDURE

CREATE PROCEDURE [dbo].[checkusername]
(
@name varchar (50),
@gender char ,
@dob nvarchar,
@deslogin nvarchar

)
AS
BEGIN

IF EXISTS(SELECT * FROM REGISTRATION WHERE [name] = @name)
BEGIN
print 10
END
ELSE
BEGIN
INSERT into REGISTRATION([name], gender,dob,deslogin) VALUES(@name,@gender,@dob,@deslogin )
END
END

No comments:

Post a Comment