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!

Dates...

Status
Not open for further replies.

B14speedfreak

Technical User
Mar 23, 2006
182
0
0
Hi all,

I am in the process of changing some Oracle sql scripts to work with mysql. Anyhow I have this script that creates tables, I think I have converted most of it to work. I get this problem when I run the <b>source</b> command to execute the sql script, when I try to do the following:

<b><i> CREATE TABLE customerorders(
ORDERID INT NOT NULL,
OrderDate DATE DEFAULT CURRENT_DATE NOT NULL,
.....
);</i></b>

Its the current date thats causing me the problems. Has anyone got any ideas how what I can use instead of <b>CURRENT_DATE</b> so that I get todays date as a default?

Thanks again,



B14... aka... Marky Mark... the frozen monkey in the server room...
 
You can only use a constant value as a field's default value. (One exception is that you can use CURRENT_TIMESTAMP as the default for a TIMESTAMP field but not for a DATE field).

You will just have to provide a value for the OrderDate field each time.
 
Ok Thanks for the replay thats very useful....

B14... aka... Marky Mark... the frozen monkey in the server room...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top