can't insert dates in SQL Server 2000

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: can't insert dates in SQL Server 2000

    Perhaps that's because what you're actually converting is 31 divided by 7
    divided by 2003 instead of the string '31/07/2003'.

    Ray at home

    --
    Will trade ASP help for SQL Server help


    "Nick" <ektorjr@hol.gr> wrote in message
    news:355901c35544$26d7cd80$a001280a@phx.gbl...
    > Hello
    >
    > Suppose many of you have faced this problem before. I try
    > to insert a date form my ASP page in SQL Server 2000 (in
    > a smalldatetime datatype), but this seems impossible.
    >
    > After receiveing many error messages i found that i had
    > to use the Convert function in my query. Well, I am using:
    >
    > update games set game_date=CONVERT(smalldatetime,
    > 31/07/2003)
    >
    > The query works fine, but it inserts the value 01/01/1900
    > in the database. I also tried others formats of the date
    > (07/31/2003 etc.) but nothing works.
    >
    > It would be gretaly appreciated if could have a code
    > snippet with an insert statement for SQL Server from ASP
    > contaning dates.
    >
    > Thanks in advance.
    >
    > Nick
    >

    Ray at Guest

  2. Similar Questions and Discussions

    1. Problem with insert dates
      Hi, I have a problem on my CFMX 6.1 server. When I try to insert a date in a access DB it insert not the right date but the right date less one...
    2. Access 2000 and Dates going wrong
      Hi, Can anyone tell me how to fix my date problem in MX2004 and Access 2000. I have a table where I am trying to only get records of a certain...
    3. Problem with insert dates in SQL
      Hi, I have a table with a camp "Fecha" (it is datetime).I insert a date in this format: dd/mm/yy (for example 01/11/2003) but in the table the...
    4. Error in COM+ while migrating from 2000 Server to 2000 Advace Server
      Hi, I have one 3 tier architecture application running on Windows 2000 Server. I have created replica of same machine on another machine where OS...
    5. Error while porting applicaition from 2000 Server to 2000 advace Server
      Hi, I have one 3 tier architecture application running on Windows 2000 Server. I have created replica of same machine on another machine where OS...
  3. #2

    Default Re: can't insert dates in SQL Server 2000

    > update games set game_date=CONVERT(smalldatetime,
    > 31/07/2003)
    Dates are strings, not numbers, at least in this context (storage is another
    issue).

    So, you need to use quotes.

    Also, you should try and avoid regionally formatted dates, they introduce
    ambiguity and potential errors / data corruption. Try:

    UPDATE games SET game_date = '2003-07-31'

    A


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: can't insert dates in SQL Server 2000

    Actually, safer without the dashes

    UPDATE games SET game_date = '20030731'


    Aaron Bertrand - MVP Guest

  5. #4

    Default Re: can't insert dates in SQL Server 2000

    I used quotes at first, but I alwys received an error mesage. When i
    tried this it worked. So I assumed that, within the convert function it
    needed no quotes.

    Nick


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Nikos Drandakis Guest

Posting Permissions

  • You may not post new threads
  • You may 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