grant | 1 Feb 2013 01:16
Picon
Favicon

hdbc-odbc not getting any data using mssql stored procedure

Hi,

I am trying to call a stored procedure (exec gp_somestoredproc 123,22) 
using microsoft sql server 2008 R2 using hdbc-odbc.

Here is the haskell code:

import Database.HDBC 
import Database.HDBC.ODBC
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as B

test1 = do 
  c <- connectODBC "Driver={SQL Server};Server=?;Database=?;uid=sa;pwd=?;"
  p <- prepare c "exec gp_somestoredproc 123,22" -- returns no data
 --  p <- prepare c "exec [sys].sp_datatype_info_100 0, <at> ODBCVer=4;exec 
gp_somestoredproc 123,22" -- all is good
  e <- execute p []  -- returns 6 (number of rows)
  putStrLn $ "execute " ++ show e
  r <- fetchAllRows' p
  putStrLn $ "fetchAllRows' " ++ show r 

The problem is that this code returns the number of rows correctly but 
doesn't return data nor are there any errors.

However, I ran a perl program using perl dbi and got the data correctly.

Here is the perl code:

(Continue reading)


Gmane