Click here to Skip to main content
15,885,365 members
Home / Discussions / Database
   

Database

 
QuestionOLEDB connection to a SQL server database hosted in an availability group (repost) Pin
kmoorevs2-Jan-18 11:38
kmoorevs2-Jan-18 11:38 
AnswerRe: OLEDB connection to a SQL server database hosted in an availability group (repost) Pin
PIEBALDconsult2-Jan-18 14:12
mvePIEBALDconsult2-Jan-18 14:12 
GeneralRe: OLEDB connection to a SQL server database hosted in an availability group (repost) Pin
kmoorevs4-Jan-18 8:33
kmoorevs4-Jan-18 8:33 
AnswerRe: OLEDB connection to a SQL server database hosted in an availability group (repost) Pin
Joe DiNatale4-Jan-18 11:10
Joe DiNatale4-Jan-18 11:10 
GeneralRe: OLEDB connection to a SQL server database hosted in an availability group (repost) Pin
kmoorevs4-Jan-18 11:33
kmoorevs4-Jan-18 11:33 
GeneralRe: OLEDB connection to a SQL server database hosted in an availability group (repost) Pin
S Douglas7-Mar-18 11:35
professionalS Douglas7-Mar-18 11:35 
AnswerRe: OLEDB connection to a SQL server database hosted in an availability group (repost) Pin
S Douglas7-Mar-18 11:31
professionalS Douglas7-Mar-18 11:31 
QuestionMore than interesting... Pin
Kornfeld Eliyahu Peter31-Dec-17 21:05
professionalKornfeld Eliyahu Peter31-Dec-17 21:05 
AnswerRe: More than interesting... Pin
Jörgen Andersson1-Jan-18 3:44
professionalJörgen Andersson1-Jan-18 3:44 
GeneralRe: More than interesting... Pin
Kornfeld Eliyahu Peter1-Jan-18 4:31
professionalKornfeld Eliyahu Peter1-Jan-18 4:31 
GeneralRe: More than interesting... Pin
Jörgen Andersson2-Jan-18 5:28
professionalJörgen Andersson2-Jan-18 5:28 
SuggestionRe: More than interesting... Pin
Richard Deeming8-Jan-18 7:22
mveRichard Deeming8-Jan-18 7:22 
GeneralRe: More than interesting... Pin
Jörgen Andersson8-Jan-18 9:03
professionalJörgen Andersson8-Jan-18 9:03 
GeneralRe: More than interesting... Pin
Richard Deeming9-Jan-18 1:26
mveRichard Deeming9-Jan-18 1:26 
GeneralRe: More than interesting... Pin
Jörgen Andersson9-Jan-18 8:39
professionalJörgen Andersson9-Jan-18 8:39 
It certainly is unclear. So I tested by creating a couple of procedures.
SQL
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 7:04
jschell1-Jan-18 7:04 
GeneralRe: More than interesting... Pin
Kornfeld Eliyahu Peter1-Jan-18 8:23
professionalKornfeld Eliyahu Peter1-Jan-18 8:23 
GeneralRe: More than interesting... Pin
ZurdoDev8-Jan-18 8:05
professionalZurdoDev8-Jan-18 8:05 
QuestionTrigger value > ? write in different table Pin
brian121026-Dec-17 13:44
brian121026-Dec-17 13:44 
AnswerRe: Trigger value > ? write in different table Pin
Victor Nijegorodov26-Dec-17 22:13
Victor Nijegorodov26-Dec-17 22:13 
AnswerRe: Trigger value > ? write in different table Pin
Richard MacCutchan26-Dec-17 22:41
mveRichard MacCutchan26-Dec-17 22:41 
Rant[REPOST] Trigger value > ? write in different table Pin
Richard Deeming8-Jan-18 7:24
mveRichard Deeming8-Jan-18 7:24 
Questiondata between 1st jan to December 31st of previous year query --no hard coded dates. Pin
sai.201226-Dec-17 10:51
sai.201226-Dec-17 10:51 
AnswerRe: data between 1st jan to December 31st of previous year query --no hard coded dates. Pin
Victor Nijegorodov26-Dec-17 22:06
Victor Nijegorodov26-Dec-17 22:06 
AnswerRe: data between 1st jan to December 31st of previous year query --no hard coded dates. Pin
Chris Quinn27-Dec-17 0:01
Chris Quinn27-Dec-17 0:01 

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.