raiseerror

Raiseerror and Concat for the Message

I'd like to do something like this raiserror(concat('Error in case @isFishy =', @isFishy, ' @isSmarmy=', @isSmarmy, ' @isTasty = ', @isTasty), 10, 1) --or raiserror('Error in case @isFishy =' + @isFishy + ' @isSmarmy=' + @isSmarmy + ' @isTasty = ' + @isTasty, 10, 1) But it just isn't working. How do I accomplish this? I'm in SQL S...

How can I capture a SQL Stored Procedure Error triggered by RAISEERROR() in .asmx file?

I'm very new to .NET. All I've done so far is implement some SQL Stored Procedure calls as WebServices by copying and pasting existing code (as instructed by my superior). I am calling some commands via Database.ExecuteNonQuery(). In the SQL Stored Procedure, I am performing some security checks based on the LoginId passed in (a user ca...

Raise Error problem when connecting to SQL Server through ODBC

Hi, I have a system that connect to SQL Server through ODBC. When I try to raiseerror from an IF...ELSE statement, it does not triggered the exception handling. I have done some raise error testing at my side. Below is my finding: RaiseError did not triggered exception: CREATE PROC xxx AS IF 1=1 BEGIN raiserr...

How to keep on transaction when it fails for some rows?

Hello! I want that when I execute a query for example DELETE FROM Contact, and an error is raised during the transaction it should delete the rows that are able to be deleted raising all the relevant errors for the rows that cannot be deleted. ...

SQL GOTO statement in a script with multiple GO

I need to exit a SQL script without an error if a certain condition holds true. I've read that 1 solution would be to raiseerror with error code 20+ and with log parameter. But the limitation for that is that i can execute that only as an admin and the connection to the db will be aborted. Also, I tried using GOTO and jump to the end-o...