A simple question here.
Context: A Transact-SQL table with an int primary key and a name that should also be unqiue (although this is not a primary key). Let them talk:
TableID INT,
TableName NVARCHAR(50)
I add new rows for this using a stored procedure (and thus specifying a TableName with a parameter).
Question: What is the best / easiest way to check if the already specified TableName parameter exists in the table and prevent the addition of a new row, if so?
Is it possible to do this directly in my AddNewRow stored procedure?
source
share