Professional Web Applications Themes

How to store Date in SQL Server - Microsoft SQL / MS SQL Server

Hello, I have problems with Storing Dates into SQL Server. I am using ASP to do so. When I change my locale settings to "Chinese - Taiwan". I hit an error saying the at the Date format is not right. Then, I create a function which returns: YYYY-MM-DD HH:MM:SS and it can work. However, I heard that the locale setting of the Database could be changed. Hence, will it give me errors again? And if yes, What can be done to make sure that the Date format will be accepted regardless of the database locale settings. Thanks. Regards, Odelia...

  1. #1

    Default How to store Date in SQL Server

    Hello,
    I have problems with Storing Dates into SQL Server. I am
    using ASP to do so.

    When I change my locale settings to "Chinese - Taiwan". I
    hit an error saying the at the Date format is not right.
    Then, I create a function which returns: YYYY-MM-DD
    HH:MM:SS and it can work.

    However, I heard that the locale setting of the Database
    could be changed. Hence, will it give me errors again? And
    if yes, What can be done to make sure that the Date format
    will be accepted regardless of the database locale
    settings.

    Thanks.
    Regards,
    Odelia
    Odelia Guest

  2. #2

    Default Re: How to store Date in SQL Server

    If you pass datetime values as string, use a "safe" format. Most developers prefer 'YYYYMMDD
    HH:MM:SS'. If you don't like that, you need to look into the SET DATEFORMAT setting.

    --
    Tibor Karaszi, SQL Server MVP
    Archive at: [url]http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver[/url]


    "Odelia" <peach82sg.sg> wrote in message
    news:07c001c345e2$0f820310$a501280aphx.gbl...
    > Hello,
    > I have problems with Storing Dates into SQL Server. I am
    > using ASP to do so.
    >
    > When I change my locale settings to "Chinese - Taiwan". I
    > hit an error saying the at the Date format is not right.
    > Then, I create a function which returns: YYYY-MM-DD
    > HH:MM:SS and it can work.
    >
    > However, I heard that the locale setting of the Database
    > could be changed. Hence, will it give me errors again? And
    > if yes, What can be done to make sure that the Date format
    > will be accepted regardless of the database locale
    > settings.
    >
    > Thanks.
    > Regards,
    > Odelia

    Tibor Karaszi Guest

Similar Threads

  1. How to store Date in SQL Server?
    By Odelia in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: August 22nd, 03:11 PM
  2. store/retrieve images to server
    By Suren_kancherla in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: April 11th, 07:02 AM
  3. date from server
    By Ike in forum PHP Development
    Replies: 2
    Last Post: June 26th, 07:32 AM
  4. Replies: 3
    Last Post: October 21st, 07:13 PM
  5. Server Date
    By Micheal in forum ASP.NET General
    Replies: 1
    Last Post: July 25th, 03:27 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139