I want to create a procedure that takes in a string, searches the table and the specified column for that string, and returns a 1 if it finds it and a zero if it does not. I am relatively new to SQL and do not know the syntax or commands very well. I want something like this:
CREATE PROCEDURE dbo.GetUsername
(
@Username NCHAR(10)
)
AS
@boolVariable
SELECT @Username FROM Accounts
RETURN @boolVariable
You don’t return a value, but instead supply that in a result set.
In your calling code, simply check for the existence of a row in the result set.