Re: Update a date

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 03/10/04


Date: Wed, 10 Mar 2004 15:37:26 +0100

You are doing integer arethmics in your query, as you don't enclose the date
inside single quotes. Also, always use a language neutral datetime format
(see end of post), or make sure you SET DATEFORMAT first.

Examples of language neutral formats:

'19980523 00:00:00' --You can leave out time portion
'1998-05-23T00:00:00'

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Robert Batt" <anonymous@discussions.microsoft.com> wrote in message
news:4E8DA035-D6B2-4B73-8179-43754AB7744D@microsoft.com...
> Hello,
>        I simply wish to update a date field in a sql database table to a
new date.  the column is of type smalldatetime
>
> I have tried the following  and it just updates the date to 1900-01-01
which is not good.
>
> Update mytable set MyNewDate = 27/03/2004
> Where MyIndex key = 663
>
> Any ideas in this seemingly simple query would be appreciated
>
> Robert


Relevant Pages

  • Re: upadting db
    ... One is to pass a query (e.g. ... "UPDATE MyTable SET SomeColumn = 'Some Value') that updates the record. ... > strSQL= "SELECT * FROM Password" ... > Dim objRS ...
    (microsoft.public.frontpage.client)
  • Re: Date/Time
    ... you can write an Update query: ... UPDATE MyTable SET MyDateField = DateValue ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.queries)
  • Re: Newbie question about formula based values
    ... Will this query only run when I run it in Access? ... to be updated on a constant basis without me having to do anything. ... Update MyTable Set Level=1 Where EndDate<DateAND Level=2 ... customer contracts are due to end and manually update the value in the ...
    (comp.databases.ms-access)
  • Re: Update query
    ... Steve Schapel, Microsoft Access MVP ... The value from one of these has to be obtained by running another query (which does a SUM function, so it returns a single row with a single column, ie just one value), and this seems a bit naff. ... UPDATE myTable SET field1=, field2=FROM myOtherTable) WHERE ... ...
    (microsoft.public.access.gettingstarted)
  • Re: Newbie question about formula based values
    ... Create your query. ... In this macro have a single item that calls RunCode. ... In Windows scheduler, create a new scheduled task based on Microsoft ... Update MyTable Set Level=1 Where EndDate<DateAND Level=2 ...
    (comp.databases.ms-access)