Skip to content
Advertisement

Validate that a new username doesn’t match a pre-existing username

I wanted to implement a validation in my SQL stored procedure that’s designed to create new users. I wanted to validate that a new user can’t use the same username as another user. This is my current stored procedure:

I assume I need to do something using an if statement that takes the value entered from the user in @login, and cross checks it with the USERS table’s username column. Any guidance on the best approach?

Advertisement

Answer

This is what I would do

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement