Create a stored procedure to check if username is in use. This stored procedure returns 1 if the user name is already taken, else 0.
Create procedure spUserNameExists
@UserName nvarchar(100)
as
Begin
Declare @Count int
Select @Count = Count(UserName)
from tblRegistration
where UserName = @UserName
If @Count ] 0
Select 1 as UserNameExists
Else
Select 0 as UserNameExists
End
tham khao tai day.