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

AlterTable with Default Date?

Status
Not open for further replies.

Zoon

Technical User
Nov 27, 2002
28
US
The company has Windows 98 computers and an inventory database using MS Jet 3.5. Using SQL, I need to add a date field called [Date First Received] and have a date like 6/29/02 entered when the record is created. I am a SQL novice and when I tried ALTER TABLE [Product1] ADD COLUMN [Date First Received] DATETIME I got the new field/column. How can I add this column and have a default computer clock date, but not the time, entered? I tried ALTER TABLE [Product1] ADD COLUMN [Date First Received] DATETIME DEFAULT(DATE) also ALTER TABLE [Product1] ADD COLUMN [Date First Received] DATETIME = DATE() and these did not work.


 
I don't believe Jet 3.5 (or 3.6) supports column default values. In an Access application, it's Access that supplies the default values when adding a record. You make that setting in the Access table design grid. If you're using something besides Access to front-end the Jet database, you need to look to that product to do it for you.

Where did you get this SQL syntax? It looks like it might be Jet 4.0, SQL Server, or Oracle--something, at least, a little more advanced than Jet 3.5. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top