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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determine when table was "lastupdated"

Status
Not open for further replies.

cyberbiker

Programmer
Mar 16, 2001
431
0
0
US
I statrted a new thread even though this is very much related to another one I had started, so I apologize if I am wrong but I think there is enough difference in what I need to make starting a new thread advisable.

I am modifying existing code to change from ACCESS 97 tables (Jet) to SQL Server 7 tables using ODBC Direct instead of ADO

The current code uses TableDefs a few places.

I think I have fumbled through things and studied the help menu enough to handle all i need for now except how to determine when a table was last updated.

The following function is currently in use and does what is needed:


Function pfRackListRecent() As Integer
' Checks if the current rack list was recently generated
Dim db As Database, td As TableDef, sec As Variant
(above line db will be changed to dim db as connection)


On Error Resume Next
Set db = DBEngine(0)(0)
db.TableDefs.Refresh
Set td = db.TableDefs(pcRACKLISTNAME)
sec = DateDiff("s", td.LastUpdated, Now)
pfRackListRecent = (ERR = 0 And sec < 120)

End Function

What I need to find out is how do I do the same thing with SQL server?

I have waded through the help (along with a couple of books I have here) and think that I need to use the lastprocessed property of the dimension interface. But I seem to be missing something. I just do not understand what I am reading. I suspect I have missed some basic concept.

Would I do something like this?

(pcRACKLISTNAME is a string assigned the name of a table )

Function pfRackListRecent() As Integer
' Checks if the current rack list was recently generated
Dim db As Connection, sec As Variant
Dim dsoTest As DSO.Dimension

On Error Resume Next
Set db = DBEngine(0)(0)
Set dsoTEST = db.Dimensions.AddNew(pcRACKLISTNAME)

If dsotest.State <> olpaStateNeverProcessed Then

sec = DateDiff(&quot;s&quot;, dsotest.last processed, Now)
End If

End If


pfRackListRecent = (ERR = 0 And sec < 120)

End Function

Any help would be appreciated greatly. I truly do not understand this part at all
Terry (cyberbiker)
 
Well, the good news is that I decided to use my head a bit.
It seems that this function is only called from a sub that is never used! Oh well.
But any ideas would still be appreciated. I will most likely run into something like this again Terry (cyberbiker)
 
You could set up a table that would be updated by a set of triggers (Update, Delete, Insert). You could capture the date, user, etc...
 
Yes, but is there not a way to determine this from the table properties? I am getting the impression from what I read that I can use the last processed property, but cannot seem to quite figure out how.
Or am I way off base again? I am pretty confused about the dimension interface right now.
It has been only a few weeks that I have messed with SQL Server and MSDE. I have crammed a lot of reading and experimentation into a short time. At this point, I am not totally certain of anything. Reading as many of the posts in this forum as I can possibly find time to analyze what was posted has been a big help Terry (cyberbiker)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top