Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 59427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:00:13+00:00 2026-05-10T18:00:13+00:00

First of all (in case this is important) I’m using ActiveState’s Perl (v5.8.7 built

  • 0

First of all (in case this is important) I’m using ActiveState’s Perl (v5.8.7 built for MSWin32-x86-multi-thread).

I’ve just emerged from a three hour long debugging session, trying to find the source of an error. I found there was simply no error, but for some reason ADO’s connection object was getting the Errors.Count increased with each printed message in my stored procedure’s output.

Consider following Transact SQL code:

CREATE PROCEDURE dbo.My_Sample() AS BEGIN TRAN my_tran -- Does something useful if @@error <> 0 BEGIN   ROLLBACK TRAN my_tran   RAISERROR( 'SP My_Sample failed', 16, 1) END ELSE BEGIN   COMMIT TRAN my_tran   PRINT 'SP My_Sample succeeded' END 

Now imagine a Perl sub more or less like:

sub execute_SQL {   # $conn is an already opened ADO connection object   # pointing to my SQL Server   # $sql is the T-SQL statement to be executed   my($conn, $sql) = @_;   $conn->Execute($sql);   my $error_collection = $conn->Errors();   my $ecount = $error_collection->Count;   if ($ecount == 0 ) { return 0; }   print '\n' . $ecount . ' errors found\n';   print 'Executed SQL Code:\n$sql\n\n';   print 'Errors while executing:\n';   foreach my $error (in $error_collection){     print 'Error: [' . $error->{Number} . '] ' . $error->{Description} . '\n';   }   return 1; } 

Somewhere else, in the main Perl code, I’m calling the above sub as:

execute_SQL( $conn, 'EXEC dbo.My_Sample' ); 

In the end I got it that every PRINT statement causes a new pseudo-error to be appended to the ADO Errors collection. The quick fix I implemented was to change that PRINT in the SP into a SELECT, to bypass this.

The questions I’d like to ask are:

  • Is this behaviour normal?
  • Is there a way to avoid/bypass it?
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:00:13+00:00Added an answer on May 10, 2026 at 6:00 pm

    This is to be expected as it’s what ADO does and the Win32::ADO is quite a thin layer above it.

    ref: knowledge base note that the RAISERROR and PRINT statements are returned through the ADO errors collection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use camel case which has the first letter of all variable names, functions,
First of all, this isn't for a keylogger, it's for an input in a
First of all there is probably a question like this already but i couldn't
First of all, apologize because I have seen some posts about this, but I
first of all sorry if this isn't formatted correctly, first time doing this. I've
First and foremost: JSON and XML are not an option in this specific case,
first of all some details: I configured security as below in web.xml view plaincopy
First of all, I'm quite new to the Android and JAVA world (coming from
first of all i would like to say i know its probably an easy
First of all I want to mention two things, One: My code isn't perfect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.