I have a stored procedure that takes in a Department Name and returns the Department Id in the form of an int. I'm trying to use the procedure to determine if a department with the specified name already exists. How can I accomplish this? If the sproc returns no results, what is the value represented by? Is it null? Should I possibly be using a separate sproc to determine if the department already exists? Here is my current sproc:
@Department_Name varchar(100),
@Id int OUTPUT
AS
SET NOCOUNT ON
SELECT @Id = Id FROM Department
WHERE Name = @Department_Name
RETURN @Id