In playing around with the procedure, I can get a a return -6, if I insert a null into foo.KeyCol and remove the RAISERROR in the inner catch. This is something SQL Server is doing, and is documented here: Return Values from Stored Procedures.
More Related Contents:
- T-SQL stored procedure that accepts multiple Id values
- Select columns from result set of stored procedure
- Escape a string in SQL Server so that it is safe to use in LIKE expression
- EXEC sp_executesql with multiple parameters
- T-SQL Dynamic SQL and Temp Tables
- How do I find a stored procedure containing ?
- Check if a string contains a substring in SQL Server 2005, using a stored procedure
- Why can’t Entity Framework see my Stored Procedure’s column information?
- Max Nbr of Months W/ No Activity in Past 12 Months
- SQL server query to output the data shown below
- Will ANSI JOIN vs. non-ANSI JOIN queries perform differently?
- Function vs. Stored Procedure in SQL Server
- How do you view ALL text from an ntext or nvarchar(max) in SSMS?
- Floor a date in SQL server
- Create a view with ORDER BY clause
- What does ‘COLLATE SQL_Latin1_General_CP1_CI_AS’ do?
- INSERT INTO vs SELECT INTO
- Possible to store value of one select column and use it for the next one?
- SQL Server SELECT into existing table
- How to list all dates between two dates [duplicate]
- SQL Server sp_msforeachtable usage to select only those tables which meet some condition
- How to check if a stored procedure exists before creating it
- Scheduled run of stored procedure on SQL server
- SQL Server ORDER BY date and nulls last
- SQL Server variable columns name?
- Convert decimal time to hours and minutes
- SQL Query Where Column = ” returning Emoji characters 🎃 and 🍰
- FOR JSON PATH results in SSMS truncated to 2033 characters
- How Can I Detect and Bound Changes Between Row Values in a SQL Table?
- SQL Server error “Implicit conversion of because the collation of the value is unresolved due to a collation conflict.”