kjg has asked for the wisdom of the Perl Monks concerning the following question:
The $Sql isuse Win32::ODBC; use CGI qw(:standard); use CGI::Carp qw/fatalsToBrowser/; sub NoFeedback {for (1 or 0) if (!($db=new Win32::ODBC($DSN))) { print "Error connecting to Database\n"; print "Error: " . Win32::ODBC::Error() . "\n"; } #end if (!($db=new Win32::ODBC($DSN))) $SqlStatement = $sql; print "SqlStatement = $SqlStatement"; if ($db->Sql($SqlStatement)) { print "SQL failed.\n"; print "Error: " . $db->Error() . "\n"; if ($DebugMode) { print "<HR>$SqlStatement<HR>"; } #end if ($DebugMode) } # end if ($db->Sql($SqlStatement)) else { while($db->FetchRow()) { $Email = $db->Data(); $MAilOut = $MAilOut.$Email."\n"; print "Emailing: $Email\n<BR>"; $db->Close(); }#END sub NoFeedback
This bit of SQL executes fine in Query Analyzer but returns this error when executed as part of the script:SELECT DISTINCT Feedback.Email FROM Feedback LEFT OUTER JOIN FOSBriefe +r ON Feedback.Username = FOSBriefer.Username WHERE (ISNULL(FOSBriefer +.Username, 'z') = 'z')
Is the SQL Statement simply too long or is it something else obvious?SQL failed. Error: [911] [1] [0] "[Microsoft][ODBC Driver Manager] Inv +alid string or buffer length"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::ODBC invalid string or buffer length
by kjg (Sexton) on Jun 07, 2005 at 14:54 UTC | |
by VSarkiss (Monsignor) on Jun 07, 2005 at 15:14 UTC |