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

Creating a timestamp field using SQL

Status
Not open for further replies.

Ronin441

Programmer
Feb 22, 2002
128
0
0
AU
I've got this bit of SQl to create a Paradox table that goes:
Code:
DM.LeagueDatabase.Execute('CREATE TABLE ' + TableName + '(' +
    'ID VARCHAR(8),  ' +
    'Game DATE,      ' +
    '(plus a bunch of other fields) ' +
    'PRIMARY KEY (ID, Game) )', nil, False, nil);
, which does what I want except that the Game field gets created as a Date field, when in fact I want it to be a TimeStamp.

So, I want either a way to change my CREATE so that it creates the timestamp field that I want, or I want someone to tell me that as far as my app is concerned, it won't be able to tell the difference between the two field types, and I can mix legacy tables with TimeStamps and new tables with Date fields, and nothing will go horribly horribly wrong. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
I'm not familiar with Paradox data types, but on many other SQL platforms the "datetime" data type is used as a combined date/time storage.
 
In Sybase (& I think SQL Server) there is a datatype TimeStamp which is used to uniquely identify versions of each row. The user can not specify the timestamp value themselves - it is always generated by the database automatically (when a timestamp column has been added to a table).

Not sure is paradox supports this data type, sorry.

lou
 
What I'm saying is that when I create a Paradox table using a CreateTable, with a field setup line that looks like:
Code:
  FieldDefs.Add('Game', ftDateTime, 0, True);
, I get back a table containing a field whose type is, according to Database Desktop, '@', which DD's help further describes as a Timestamp. When I create a table using SQL as described above, I get a field type that DD describes as "D", or Date.

(a) Is there a way to make the SQL behave just like the CreateTable; or
(b) Are these two types in fact indistinguishable to my app? -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top