![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
Michael Drewitz wrote: Since you're getting an error (ie, you're actually submitting something to the dataserver) could you post the actual (not pseudo) code that you're working with? What you want to do (insert values into a temp table and then select all values as one result set) *IS* doable and fairly straight forward ... but at this point I can't tell if you're getting errors because of 'syntax' or 'logic' issues. It would be a lot easier to work on this in one languange (T-SQL as opposed to pseudo-code). Below is my code. The database is ASA 8.02.3601. If I execute this with |
#12
| |||
| |||
|
|
Below is my code. The database is ASA 8.02.3601. If I execute this with call dba.avg_temperature_values('2004-05-27 09:00:00', '2004-06-27 10:00:00', 5) I get an empty result set. It seems to be the query in the insert expression because select avg(fldtemperature) from tblrawdata where datediff(second, @interval_begin, fldtemperature) > 0 executed on the console causes the error 'ASA error 157: cannot convert 13 to a date'. |
|
If I uncomment the following message, the SP itself causes the same error. Curious. CREATE PROCEDURE DBA."avg_temperature_values" @start_time timestamp, @end_time timestamp, @datepart int AS declare @interval_begin timestamp, @interval_end timestamp, @timediff int, @current_value float select @timediff = datediff(second, @start_time, @end_time) select @interval_begin = @start_time if @datepart = 1 select @interval_end = dateadd(year, 1, interval_begin) |
|
insert #temp_values(avg_values) select avg(fldtemperature) from tblrawdata where datediff(second, @interval_begin, fldtemperature) > 0 and datediff(second, @interval_end, fldtemperature) < 0 and fldtemperature > -999 |
![]() |
| Thread Tools | |
| Display Modes | |
| |