rohanan has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I need to run a stored procedure which would give me a recordset-

1. How do I know that the stored procedure has been executed successfully and how do I copy the log(message tab in Microsoft SQL) into a csv file.


2. How do I export the recordset into a csv file.

Currently, I can get the recordset in $RS and the values of the first row using $RS->Fields->Item(0)

$SQLStr = "exec StoredProc_A 20110101" $RS = ACC::DatabaseAccess->GetDataRS($dbconn, $SQLStr); sub GetDataRS { my($pkg, $Conn, $sql) = @_; $RS = Win32::OLE->new("ADODB.Recordset"); $RS->Open($sql, $Conn, 1, 1); return $RS; }

Kindly advice.