Click here to Skip to main content
14,771,613 members
Home » Discussions » Database
   

Database

 
GeneralRe: More than interesting... Pin
Jörgen Andersson2-Jan-18 6:28
professionalJörgen Andersson2-Jan-18 6:28 
SuggestionRe: More than interesting... Pin
Richard Deeming8-Jan-18 8:22
mveRichard Deeming8-Jan-18 8:22 
GeneralRe: More than interesting... Pin
Jörgen Andersson8-Jan-18 10:03
professionalJörgen Andersson8-Jan-18 10:03 
GeneralRe: More than interesting... Pin
Richard Deeming9-Jan-18 2:26
mveRichard Deeming9-Jan-18 2:26 
GeneralRe: More than interesting... Pin
Jörgen Andersson9-Jan-18 9:39
professionalJörgen Andersson9-Jan-18 9:39 
It certainly is unclear. So I tested by creating a couple of procedures.
CREATE PROCEDURE dbo.SubSP1
AS
BEGIN
    PRINT 'Start SubSP1'
    RAISERROR('Some Error', 16,1) WITH LOG
    PRINT 'End SubSP1'
END
GO
-------Create SubSP2---------
CREATE PROCEDURE dbo.SubSP2
AS
BEGIN
    PRINT 'Inside SubSP2'
END

GO
-------Create MainSP---------
CREATE PROCEDURE dbo.MainSP
AS
BEGIN
    PRINT 'Start MainSP'
    EXEC dbo.SubSP1
    EXEC dbo.SubSP2 
    PRINT 'End MainSP'
END
GO

Running the MainSP results in:
Start MainSP
Start SubSP1
Msg 50000, Level 16, State 1, Procedure SubSP1, Line 6
Some Error
End SubSP1
Inside SubSP2
End MainSP
This does not stop the execution at all, Neither on statement, scope, batch or connection level.
Changing the errorlevel to 17 results in:
Start MainSP
Start SubSP1
End SubSP1
Inside SubSP2
End MainSP
Msg 50000, Level 17, State 1, Procedure SubSP1, Line 5
Some Error
Still doesn't stop the execution, but note the difference in where the error message is printed.

I suspect there will be some real differences between the errorlevels if I add TRY-CATCH or more probably a transaction.

Errorlevel 19 or higher should stop the execution of the current batch according to Database Engine Error Severities | Microsoft Docs[^] but it doesn't.

Errorlevel 20 and above closes connection as expected from the manual.

Couldn't be bothered to check any further. I've proved myself wrong and thereby only proven that one shouldn't try to answer questions on New Years day.
Wrong is evil and must be defeated. - Jeff Ello

AnswerRe: More than interesting... Pin
jschell1-Jan-18 8:04
Memberjschell1-Jan-18 8:04 
GeneralRe: More than interesting... Pin
Kornfeld Eliyahu Peter1-Jan-18 9:23
professionalKornfeld Eliyahu Peter1-Jan-18 9:23 
GeneralRe: More than interesting... Pin
ZurdoDev8-Jan-18 9:05
professionalZurdoDev8-Jan-18 9:05 
QuestionTrigger value > ? write in different table Pin
brian121026-Dec-17 14:44
Memberbrian121026-Dec-17 14:44 
AnswerRe: Trigger value > ? write in different table Pin
Victor Nijegorodov26-Dec-17 23:13
MemberVictor Nijegorodov26-Dec-17 23:13 
AnswerRe: Trigger value > ? write in different table Pin
Richard MacCutchan26-Dec-17 23:41
mveRichard MacCutchan26-Dec-17 23:41 
Rant[REPOST] Trigger value > ? write in different table Pin
Richard Deeming8-Jan-18 8:24
mveRichard Deeming8-Jan-18 8:24 
Questiondata between 1st jan to December 31st of previous year query --no hard coded dates. Pin
sai.201226-Dec-17 11:51
Membersai.201226-Dec-17 11:51 
AnswerRe: data between 1st jan to December 31st of previous year query --no hard coded dates. Pin
Victor Nijegorodov26-Dec-17 23:06
MemberVictor Nijegorodov26-Dec-17 23:06 
AnswerRe: data between 1st jan to December 31st of previous year query --no hard coded dates. Pin
Chris Quinn27-Dec-17 1:01
MemberChris Quinn27-Dec-17 1:01 
AnswerRe: data between 1st jan to December 31st of previous year query --no hard coded dates. Pin
jschell1-Jan-18 8:11
Memberjschell1-Jan-18 8:11 
Rant[REPOST] data between 1st jan to December 31st of previous year query --no hard coded dates. Pin
Richard Deeming8-Jan-18 8:27
mveRichard Deeming8-Jan-18 8:27 
QuestionOLE DB Data Types to C# Data Type Mapping Pin
User9874325-Dec-17 18:55
professionalUser9874325-Dec-17 18:55 
AnswerRe: OLE DB Data Types to C# Data Type Mapping Pin
Richard MacCutchan25-Dec-17 21:55
mveRichard MacCutchan25-Dec-17 21:55 
AnswerRe: OLE DB Data Types to C# Data Type Mapping Pin
Mycroft Holmes25-Dec-17 22:33
professionalMycroft Holmes25-Dec-17 22:33 
GeneralRe: OLE DB Data Types to C# Data Type Mapping Pin
User9874325-Dec-17 23:57
professionalUser9874325-Dec-17 23:57 
GeneralRe: OLE DB Data Types to C# Data Type Mapping Pin
jschell26-Dec-17 8:39
Memberjschell26-Dec-17 8:39 
GeneralRe: OLE DB Data Types to C# Data Type Mapping Pin
User9874314-Jan-18 11:44
professionalUser9874314-Jan-18 11:44 
SuggestionRe: OLE DB Data Types to C# Data Type Mapping Pin
Richard Deeming8-Jan-18 8:38
mveRichard Deeming8-Jan-18 8:38 
GeneralRe: OLE DB Data Types to C# Data Type Mapping Pin
User9874314-Jan-18 11:50
professionalUser9874314-Jan-18 11:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.