date() won't work...

P

piero

Hi,
I'm building a MSDE database using access 2002.
I would create a field "currentdate" that have the current date such as
default value.
I've try with date() which works in .mdb database, but Sql return a error:
(Sorry for traslation, I'm working on italian O.S.)
"Error: can't create tabel "TableName"
error -2147221309 - [Microsoft] [ODBC SQL Server Driver] [SQL Server] 'date'
not recognized such as function's name"

Any ideas ?

Thanks in advance

Piero
Italy
 
V

Van T. Dinh

The equivalent function in MS-SQL / MSDE is GETDATE() in English version but
no ideas whether you use the same in Italian or not.
 
P

piero

I confirm, It works fine !

Thank You very much !

Piero
Italy


Van T. Dinh said:
The equivalent function in MS-SQL / MSDE is GETDATE() in English version but
no ideas whether you use the same in Italian or not.

--
HTH
Van T. Dinh
MVP (Access)



piero said:
Hi,
I'm building a MSDE database using access 2002.
I would create a field "currentdate" that have the current date such as
default value.
I've try with date() which works in .mdb database, but Sql return a error:
(Sorry for traslation, I'm working on italian O.S.)
"Error: can't create tabel "TableName"
error -2147221309 - [Microsoft] [ODBC SQL Server Driver] [SQL Server] 'date'
not recognized such as function's name"

Any ideas ?

Thanks in advance

Piero
Italy
 
E

Ezekiël

Hi,

I had the same problem too, but how can i format it by using only the date.

Greetings,

Ezekiël
Van T. Dinh said:
The equivalent function in MS-SQL / MSDE is GETDATE() in English version but
no ideas whether you use the same in Italian or not.

--
HTH
Van T. Dinh
MVP (Access)



piero said:
Hi,
I'm building a MSDE database using access 2002.
I would create a field "currentdate" that have the current date such as
default value.
I've try with date() which works in .mdb database, but Sql return a error:
(Sorry for traslation, I'm working on italian O.S.)
"Error: can't create tabel "TableName"
error -2147221309 - [Microsoft] [ODBC SQL Server Driver] [SQL Server] 'date'
not recognized such as function's name"

Any ideas ?

Thanks in advance

Piero
Italy
 
V

Van T. Dinh

Format the problem??? I got no ideas what is the problem.

Please describe in details.
 
E

Ezekiël

what i mean is, when i use getdate() the value is stored like: 11-11-2003
11:00. What i want is 11-11-2003. In access i use
format([date];"dd-mm-yyyy").
 
V

Van T. Dinh

If you want to use the SQL function, you need to use:

Convert(NChar, GetDate(), 101)

to get rid of the time component.

Note that the result of the above is a String. If you
want to convert back to DateTime value (with zero time
component, you need to use another Convert like:

Convert(DateTime, Convert(NChar, GetDate(), 101), 101)

HTH
Van T. Dinh
MVP (Access)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top