9 messages in com.mysql.lists.win32RE: Simple Value Insertion
FromSent OnAttachments
S.D.Price15 Mar 2004 08:56 
Jim Bartram15 Mar 2004 09:09 
Petr Vileta15 Mar 2004 13:45 
S.D.Price16 Mar 2004 06:30 
Petr Vileta16 Mar 2004 09:13 
Matt Fagan16 Mar 2004 17:39 
S.D.Price17 Mar 2004 01:33 
S.D.Price17 Mar 2004 02:12 
John D. Herron17 Mar 2004 08:01 
Subject:RE: Simple Value Insertion
From:S.D.Price (S.D.@open.ac.uk)
Date:03/16/2004 06:30:13 AM
List:com.mysql.lists.win32

Hi all I think I made a mistake somewhere because when I used the code

INSERT INTO tblsitefeature (updated_on) VALUES ('2004-16-01) WHERE id = 1;

INSERT INTO tblsitefeature (updated_on) VALUES ('2004-17-02') WHERE id = 2;

It created NULL values in both records. So then I tried to use this code to update the values:

UPDATE tblsitefeature SET updated = '2004-16-01' WHERE id = 1;

UPDATE tblsitefeature SET updated = '2004-17-02' WHERE id = 2;

But when I checked the db for both records the updated field shows

0000-00-00

Can anyone tell what I did wrong and how I can correct the problem.

Many thanks Steven

-----Original Message----- From: Jim Bartram [mailto:jbar@quadrivium-labs.com] Sent: 15 March 2004 17:10 To: S.D.Price Cc: mysql Subject: Re: Simple Value Insertion

This worked fine. However I now want to add a date field to my db called updated_on. Will this syntax be ok (e.g. do I quote date fields)?

Yes, you need to quote the date fields, just as you did below.

-Jim

S.D.Price wrote:

Hi, can anyone help I am new to MySQL. I have built a very simple database using this syntax:

CREATE DATABASE IF NOT EXISTS dbaccessibility; USE dbaccessibility;

CREATE TABLE tblsitefeature ( id int AUTO_INCREMENT NOT NULL PRIMARY KEY, site_name CHAR(64), accesskeys BOOL, tabindex BOOL, colours BOOL, images BOOL, resizeable_text BOOL, navigation BOOL, links BOOL, pdf BOOL, W3C_valid_markup BOOL, wcag_1 BOOL

);

I populated it with just 2 records:

INSERT INTO tblsitefeature(site_name, accesskeys, tabindex, colours, images, resizeable_text, navigation, links, pdf, W3C_valid_markup, wcag_1) VALUES ('Course Choice', 1,1,1,1,1,1,1,1,0,0);

INSERT INTO tblsitefeature(site_name, accesskeys, tabindex, colours, images, resizeable_text, navigation, links, pdf, W3C_valid_markup, wcag_1) VALUES ('Assessment', 1,1,1,1,1,1,1,1,1,1);

This worked fine. However I now want to add a date field to my db called updated_on. Will this syntax be ok (e.g. do I quote date fields)?

ALTER TABLE tblsitefeature ADD COLUMN updated_on date AFTER wcag_1;

INSERT INTO tblsitefeature (updated_on) VALUES ('2004-16-01', '2004-17-02') WHERE id = 1;

INSERT INTO tblsitefeature (updated_on) VALUES ('2004-17-02') WHERE id

= 2;

Thanks for any help Steven Price