Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-02-2009
Member
 
Join Date: Feb 2009
Posts: 71
How to Update date with SQL

Hey, i've started using MySQL for my project purpose so needless to say that i am newbie to the MySQL. I was wondering that is there a way that everyday automatically at midnight it would insert a new date for the new records to start adding.

I am trying to add number of people visiting. I can do all that. But i need for the database to insert a new row every new day.
Reply With Quote
  #2  
Old 24-02-2009
Member
 
Join Date: Dec 2008
Posts: 183
Re: How to Update date with SQL

To update the Date with the SQL statement we can use the UPDATE command. The syntax for this is:

Code:
UPDATE "table_name"
SET "column_1" = [new value]
WHERE {condition}
Let suppose we have example such as the sales for Los Angeles on 01/08/1999 is actually $500 instead of $300, and that particular entry needs to be updated. To do so, we use the following SQL:

Code:
UPDATE Store_Information
SET Sales = 500
WHERE store_name = "Los Angeles"
AND Date = "Jan-08-1999"
Hope this suggest you.
Reply With Quote
  #3  
Old 24-02-2009
Member
 
Join Date: Dec 2008
Posts: 202
Re: How to Update date with SQL

That should be

update emp set date_t = '2006-03-31 19:56:36.933'

Why did you use convert function?
What is the datatype of date_t?
Reply With Quote
  #4  
Old 24-02-2009
Member
 
Join Date: Oct 2008
Posts: 167
Re: How to Update date with SQL

SET EffectiveDate = 16 / 1 / 2006

Try

SET EffectiveDate = '2006-01-16'

As mentioned, dates must be quoted. 16 / 1 / 2006 ~= 0.00797607178464606181455633100697* 91

(16 divided by 1 divided by 2006)

If you use a format like 1/2/06 or even 1/2/2006, then there's room for confusion.

Is it the first of February, or the second of January?

If you must use a "slash" format, then I suggest replacing the month component with "Jan" / "Dec", etc.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Update date with SQL"
Thread Thread Starter Forum Replies Last Post
How to Automatic update the date in Microsoft Excel Raju Chacha MS Office Support 1 14-01-2012 02:57 PM
What is the release date of Microsoft mango update? Kaun-Dom Portable Devices 4 07-06-2011 10:52 AM
Macbook pro update date KALIDA Operating Systems 6 22-05-2010 11:52 PM
Software Update Monitor - Keep up to date! Harshal Windows Software 2 02-01-2009 08:45 AM
Date and Time Update Problems Russyan Windows XP Support 2 19-04-2007 09:13 PM


All times are GMT +5.5. The time now is 12:37 PM.