Toni Salomäki wrote:
Hi,I'm trying to write MS SQL Server support for a generic perl module used to execute arbitrary SQL statements and then return the array reference for the result set (if one exists). My basic idea was to do in following way: my $sth = $dbh->prepare($clause); $sth->execute(); return if ($sth->{NUM_OF_FIELDS} == 0); return @{$sth->fetchall_arrayref()}; But I also want to be able to create temporary tables using this same routine (for example with select ... into #tmp). This is not possible in MS SQL when prepare + execute is used. Changing the behavior of execute method to use SQLExecDirect will solve this problem (by setting $dbh->{odbc_exec_direct} = 1). But this causes following error message: Describe failed during DBI::st=HASH(0x19c2048)->FETCH(NUM_OF_FIELDS,0) The script works ok, but is there any way to get rid of this error message? I tried to read all the documentation, but I could not figure out any other way to check if the statement contains any result sets than using the NUM_OF_FIELDS. Versions in use: This is perl, v5.8.8 built for MSWin32-x86-multi-thread Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com DBD-ODBC: ODBC Driver for DBI Version: 1.13 SQL Native Client 2005.90.3042.00 Thanks in advance for any help, Toni
I'll try and reproduce here but in the mean time can you send my a simple example demonstrating this problem.
Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com
