I am not a pro! Therefore I need some expertise on the following matter:

I have a registration page that is displayed dynamically, if the user is new he registers, but before inserting the new credentials the stored procedure checks if the user name already exists. If yes, then the user is required to chose another user name.

Now, if an existing user wants to change his user name and password, he uses the same page for the update, then I need a new stored procedure to check if the new user name he choses doesn't already exists, because if I use the same sp, the current user will always be denied the update since the user obviously exists as it is itsefl.

Any idea how to build this new procedure or any sample code to refer to.

Thanks.