MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:KKolle Date:March 16 2003 8:52pm
Subject:Re: Newbie - How can I insert new data with the current date/time?
View as plain text  
Thanks Paul, that works great.
Yes, I meant to say the table animals, not bug_master.



                                                                                          
                        
                    Paul DuBois                                                           
                        
                    <paul@stripped       To:     KKolle@stripped,
mysql@stripped                      
                    t>                   cc:                                           
                           
                                         Subject:     Re: Newbie - How can I insert new
data with the current      
                    03/15/2003            date/time?                                      
                        
                    10:37 AM                                                              
                        
                                                                                          
                        
                                                                                          
                        




At 8:37 -0600 3/15/03, KKolle@stripped wrote:
>I have a table called animals (using the example in the MySQL guide). I have a
>datetime column type.
>Here is the table:

Looks like it's called bug_master, not animals. :-)

>create table bug_master (
>                id MEDIUMINT NOT NULL AUTO_INCREMENT,
>                name CHAR(30) NOT NULL,
>                date DATETIME NOT NULL,
>                PRIMARY KEY (id)
>           );
>
>I want to do a simple insert into the table with the current date
>and time, i.e.
>the system date.
>I'm having some problems finding the correct sql syntax to do this.
>Could anyone
>help with this?
>Do I need a Now() function?

That's exactly right.

>
>insert into animals <the rest of the query??>;

INSERT INTO bug_master (id,name,date) VALUES(id_val,name_val,NOW());

>
>Thanks!
>Kevin


--
Paul DuBois
http://www.kitebird.com/
sql, query




Thread
Newbie - How can I insert new data with the current date/time?KKolle15 Mar
  • Re: Newbie - How can I insert new data with the current date/time?Paul DuBois15 Mar
  • RE: Newbie - How can I insert new data with the current date/time?Uttam16 Mar
Re: Newbie - How can I insert new data with the current date/time?KKolle16 Mar
RE: Newbie - How can I insert new data with the current date/time?KKolle16 Mar