1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| DECLARE @JrM TABLE (J TINYINT);
With Cte (nm) AS
(
select 1
union all
select nm +1
from Cte
where nm < 31
)
INSERT INTO @JRM (J)
select nm from Cte;
DECLARE @15_SEC TABLE ([timestamp] datetime, point_id char(7), [_VAL] real);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-01 12:00:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-01 12:00:15 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-01 12:00:30 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-01 12:00:45 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-02 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-03 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-04 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-05 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-06 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-07 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-08 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-09 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-10 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-11 12:01:00 AM', 'FIT_101', 64);
INSERT INTO @15_SEC ([timestamp], point_id, [_VAL]) VALUES ('2010-02-12 12:01:00 AM', 'FIT_101', 64); |
Partager