Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Crazy error - supposedly Datetime field overflow
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Crazy error - supposedly Datetime field overflow
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01441804
Message ID:
01441804
Vues:
163
Hi everybody,

Looks like it's crazy time here at the tas labs. SQL Server's version 8.00.2039 (SP4), in case you want to know.

Here's a recap of what I'm doing and what's happening:

I have a remote view (document_rv) that points to the Document table in my sql server database.
I truncate Document, then open document_rv.
I populate document_rv with 488,386 records.

I issue a tableupdate(.t., .t.), which returns a value of .f. and the record pointer in document_rv is ALWAYS left at record No. 421,376.

I look in sql server, and the document table appears with 421,375 records.

Aerror() returns the following values:
1526
Connectivity error: [Microsoft][ODBC SQL Server Driver]Datetime field overflow
[Microsoft][ODBC SQL Server Driver]Datetime field overflow
22008
0

Record No. 421,376 in document_rv has nothing wrong.

After tableupdate(.t., .t.) fails, if I skip forward and then backwards, back to 421,376 and issue a tableupdate(), it works. If I then skip 1, and issue another tableupdate() it fails, and with every "skip 1", success and failure alternate.

I I explicitly go to each record (i.e. goto 427378, then tableupdate()), I'm successful each time.

Needless to say, I'm going nuts.

Ideas? Anyone? Please?

Thanks!

alex

PS: Here's the code section that's giving me a hard time:
*****
* Zap document table in sql server database.

* Close the document_rv view if it's open.
If Used( "Document_rv")
	Use in Document_rv
EndIf

* Delete contents of UnitType table
? SQLExec( liHandle, "truncate table Document") && liHandle is assigned a value somewhere else.
? SQLExec( liHandle, "dbcc checkident (Document, reseed, 0)")	

* Done zapping Document table
*****

*****
* Replace empty dates in Documents1_cu cursor 
* with 1900-01-01. Sql server seems to be having a problem with date overflow.

Update documents1_cu set DocumentRequestedDate = Date(1900,1,1) where Empty( DocumentRequestedDate)
Update documents1_cu set DocumentReceivedDate = Date(1900,1,1) where Empty( DocumentReceivedDate )
Update documents1_cu set DocumentTicklerDate = Date(1900,1,1) where Empty( DocumentTicklerDate)
Update documents1_cu set DateEntered = Date(1900,1,1) where Empty( DateEntered)

* Done fixing empty dates
*****

*****
* Insert the data into the Documents table

* Set document table to accept insertion of primary key values
Select 0
Use document_rv

? "Set document_rv identity insert on: "
?? SQLExec( CursorGetProp("ConnectHandle", "Document_rv"), "set identity_insert Document on")

Insert into document_rv ;
	select * from Documents1_cu

? "Updated document table: "
?? TableUpdate(.t., .t., "Document_rv")
Low-carb diet not working? Try the Low-food diet instead!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform