My stored procedure looks like this:
FUNCTION Get_Min(start_time timestamp, end_time timestamp, mytag char(24), myvalue integer)
Local mytime timestamp;
mytime = (select min(ts) from history where name like mytag and value > myvalue and ts between start_time and end_time);
return mytime;
end
-------------------------------
I use the following VBA to call the stored procedure and pass the necessary variables:
myDate = ActiveCell.Offset(10 + x, 1 + Y).Value
myDate2 = ActiveCell.Offset(10 + x, 2 + Y).Value
cmd.Parameters.Refresh
cmd("start_time") = Format$(myDate, "dd-mmm-yy hh:mm:ss")
cmd("end_time") = Format$(myDate2, "dd-mmm-yy hh:mm:ss")
cmd("mytag") = "2S-Turb-Spd-Rpm"
cmd("myvalue") = 150
Set ADO_rs = cmd.Execute
If (cmd(0) = myDate) Then
ActiveCell.Offset(10 + x, 8 + Y).Value = "ST already on"
Else
ActiveCell.Offset(10 + x, 8 + Y).Value = Format$(ST_Start_Date, "dd-mmm-yy hh:mm:ss")
End If
-------------
Now here is the problem. The stored procedure does return information back to excel but rather than a timestamp it returns a number. In one case it should of returned 15-Dec-2003 03:44:10 but instead it returned 1247966500.
I've never had a problem returning data from a stored procedure to excel until I tried to return a timestamp. What am I doing wrong?
David
FUNCTION Get_Min(start_time timestamp, end_time timestamp, mytag char(24), myvalue integer)
Local mytime timestamp;
mytime = (select min(ts) from history where name like mytag and value > myvalue and ts between start_time and end_time);
return mytime;
end
-------------------------------
I use the following VBA to call the stored procedure and pass the necessary variables:
myDate = ActiveCell.Offset(10 + x, 1 + Y).Value
myDate2 = ActiveCell.Offset(10 + x, 2 + Y).Value
cmd.Parameters.Refresh
cmd("start_time") = Format$(myDate, "dd-mmm-yy hh:mm:ss")
cmd("end_time") = Format$(myDate2, "dd-mmm-yy hh:mm:ss")
cmd("mytag") = "2S-Turb-Spd-Rpm"
cmd("myvalue") = 150
Set ADO_rs = cmd.Execute
If (cmd(0) = myDate) Then
ActiveCell.Offset(10 + x, 8 + Y).Value = "ST already on"
Else
ActiveCell.Offset(10 + x, 8 + Y).Value = Format$(ST_Start_Date, "dd-mmm-yy hh:mm:ss")
End If
-------------
Now here is the problem. The stored procedure does return information back to excel but rather than a timestamp it returns a number. In one case it should of returned 15-Dec-2003 03:44:10 but instead it returned 1247966500.
I've never had a problem returning data from a stored procedure to excel until I tried to return a timestamp. What am I doing wrong?
David