Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am trying to insert a time series

Status
Not open for further replies.

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

 
I was just trying to help ya. But Havent understand your question/what you actualy want us to do ? sorry. someone else will help ya.
 
Sorry about being vague. My question is whether I have failed to configure ADODB.Command properly and that is the reason it fails to insert the proper number of records. Is there a property with ADODB.Command that would cause it to exit a While loop before its condition is met?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top