Dear Perl geniuses,

Need a sanity check please. The following sql "select DATEADD(day, DATEDIFF(day, 2, GETDATE()), '20:00:00') as ADATE" runs correctly in Microsoft SQL query analyzer..

However in perl on a Win7 64bit environment, it complains with the following error "Description: MicrosoftODBC SQL Server Driver Cursor type changed".

My code can runs select and update statements against tables with no issues so I am a bit stumbled about the cursor error.

Note that I have not included my connection string but have illustrated that I am using Win32::OLE.

use Win32::OLE; $conn->{ConnectionString} = "..."; $conn->open; # open connection to the DB $state = $conn ->state; #1 means connected if($state ne "1"){... $mssql_select = "select DATEADD(day, DATEDIFF(day, 2, GETDATE()), '20 +:00:00') as ADATE"; $rs->Open( $mssql_select, $conn); my $error_collection = $conn->Errors(); my $ecount = $error_collection->Count; my ($is_message, $real_error_found); foreach my $error (in $error_collection) { #output error statements $is_message = ($error->{SQLState} eq "01000" && $error->{NativeErr +or}==0); $real_error_found=1 unless $is_message; $status = "ERROR # " . $error->{Number} . "\n Description: " . $error->{Description} . "\nSource: " . $error->{Source} . "\n"; }

Results in "Description: Microsoft ODBC SQL Server Driver Cursor type changed". Any ideas the group can provide would be appreciated.

Thank You,

AJ


In reply to Perl OLE32 MSSQL SELECT dateadd function results in “Cursor type changed” error by newbieperlperson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.