Datetime Defaults

Datetime Defaults

Post by Richard Thoma » Sun, 31 Dec 1899 09:00:00



didn't > work either. > > Thanks for any light anyone can shed on this. > >

Troy,

Try this:
        time_stamp DATETIME YEAR TO SECOND DEFAULT CURRENT YEAR TO
SECOND NOT NULL

It will work.  It seems strange that this should be essential -
generally in the manuals there is a lot of discussion about how the bits
of a DATETIME or EXTEND() that are left out are defaulted, and  how
additional precision is just truncated.  But in the CREATE TABLE
statement, it seems necessary to be this explicit.

Hope that helps

RET


 
 
 

Datetime Defaults

Post by Sujit... » Sun, 31 Dec 1899 09:00:00


     Troy

     Try

     time_stamp DATETIME YEAR TO SECOND CURRENT YEAR TO SECOND NOT NULL;

     HTH

     Sujit

______________________________ Reply Separator _________________________________
Subject: Datetime Defaults

Date:    8/22/98 3:00 PM

In dbaccess I get a "591: Invalid default value for column/variable
(time_stamp)" when I try to create a field in my table as follows:

time_stamp           DATETIME YEAR TO SECOND DEFAULT CURRENT NOT NULL

Why is it balking at the use of "CURRENT"?  I tried "TODAY" but it didn't
work either.

Thanks for any light anyone can shed on this.

 
 
 

1. HOWTO : sp datetime default parameters

There is no need to use convert. SQL Server has an implicit conversion
from varchar to datetime. Just say:


You should use the date format YYYYMMDD, because that's the only format
that is not affected by language and dateformat settings. For instance
'18/10/01' probably gives error on a default installation of SQL Server,
which use US formats for dates where the month comes first.

The prefix sp_ is reserved for system procedures. SQL Server will first
look for procedures with such names in the master database. You should
not use them for your own procedures.

By the way, the newsgroup you have posted to,
microsoft.public.sqlserver.misc is officially defunct. You are more
likely to get better response in one of the existing groups. For
this query microsoft.public.sqlserver.programming seems appropriate.
I've crossposted to this group and directed followups there.

--
Erland Sommarskog, Abaris AB

SQL Server MVP

2. IT/net: Project Manager / Coach - Client Server Applications - Toronto

3. DateTime default value

4. recommendations on pl/sql debuggers

5. DATETIME default in Stored Procedure

6. select 'current' child based on Effective date

7. Datetime Defaults

8. data transformation service

9. default datetime format

10. Kinda Urgent---Default for DateTime field?

11. datetime where default value = today

12. datetime and default values

13. Current date and time as the Default Value for a DateTime Field