Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: how to set the default value

    I have database in sql server. One field called datesent, i would like to set the default value as now(), i just type in the default value in database design, it didn't work. Please help, many thanks.

  2. #2
    Join Date
    Nov 2005
    Posts
    3
    try this: getdate()

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    It works, thank you very much!

  4. #4
    Join Date
    Mar 2004
    Posts
    660

    Exclamation another question for getdate()

    I use the getdate() as the default value. But i found the value like "
    11/8/2005 10:14:00 AM. How can i set the default value like the format as:
    11/8/2005. Thanks.

  5. #5
    Join Date
    Feb 2004
    Location
    Bangalore, India
    Posts
    250
    hi,

    try this

    create table yourTable
    (
    ColumnName datetime default convert(varchar,getdate(),107)
    )
    Cheers....

    baburajv

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •