forecasting
Programmer
- May 2, 2002
- 130
I am trying to insert a time series into a table. The table consists of two fields, a time stamp that increments 15 minutes for each record and a second time stamp that is 15 minutes later than the first stamp.
TT15_Stamp TT15_Stend
1/1/2001 00:15 1/1/2001 00:30
1/1/2001 00:30 1/1/2001 00:45
The following code will perform correctly when I execute it from the SQL Query Analyzer. However, when I execute the code from ADO, it will only insert 114 records at a time. I am using the ADODB.Command method.
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = cn
.CommandText = sqlQ
.CommandTimeout = 60
Set rs = .Execute
End With
Have I bumped into a timing issue? I set .CommandTimeout to 60, but that made no difference.
sqlQ = [the following query]
DECLARE @mindate varchar(30)
SET @mindate = '1/1/2003'
DECLARE @datestring varchar(30)
SET @datestring = CONVERT(CHAR,(SELECT ISNULL((SELECT MAX(TT15_stamp) FROM TimTab15),
(SELECT ISNULL((SELECT MIN(STAMP) FROM DLMA_BLDG1ST_FLREASTMA_AHU_1), @mindate)))),101)
WHILE @datestring < DATEADD(mm, 1, GETDATE())
BEGIN
INSERT INTO TimTab15(TT15_stamp, TT15_stend)
VALUES (DATEADD(mi, 15, @datestring), DATEADD(mi, 30, @datestring))
SET @datestring = (SELECT MAX(TT15_stamp) FROM TimTab15)
END
TT15_Stamp TT15_Stend
1/1/2001 00:15 1/1/2001 00:30
1/1/2001 00:30 1/1/2001 00:45
The following code will perform correctly when I execute it from the SQL Query Analyzer. However, when I execute the code from ADO, it will only insert 114 records at a time. I am using the ADODB.Command method.
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = cn
.CommandText = sqlQ
.CommandTimeout = 60
Set rs = .Execute
End With
Have I bumped into a timing issue? I set .CommandTimeout to 60, but that made no difference.
sqlQ = [the following query]
DECLARE @mindate varchar(30)
SET @mindate = '1/1/2003'
DECLARE @datestring varchar(30)
SET @datestring = CONVERT(CHAR,(SELECT ISNULL((SELECT MAX(TT15_stamp) FROM TimTab15),
(SELECT ISNULL((SELECT MIN(STAMP) FROM DLMA_BLDG1ST_FLREASTMA_AHU_1), @mindate)))),101)
WHILE @datestring < DATEADD(mm, 1, GETDATE())
BEGIN
INSERT INTO TimTab15(TT15_stamp, TT15_stend)
VALUES (DATEADD(mi, 15, @datestring), DATEADD(mi, 30, @datestring))
SET @datestring = (SELECT MAX(TT15_stamp) FROM TimTab15)
END