Inserting Multiple Values with Set
am 01.01.2010 20:34:48 von Victor Subervi--001636417335fad3ff047c1f76e0
Content-Type: text/plain; charset=ISO-8859-1
Hi;
mysql> describe products;
+--------------------------+-------------------------------- ------------------------------------------------------------ -------------------------------------------------------+---- --+-----+---------+----------------+
| Field |
Type
| Null | Key | Default | Extra |
+--------------------------+-------------------------------- ------------------------------------------------------------ -------------------------------------------------------+---- --+-----+---------+----------------+
| ID | tinyint(5)
unsigned
| NO | PRI | NULL | auto_increment |
| SKU |
varchar(40)
| NO | UNI | NULL | |
| Category |
varchar(40)
| YES | | NULL | |
| Name |
varchar(50)
| NO | | NULL | |
| Title |
varchar(100)
| NO | | NULL | |
| Description |
mediumtext
| NO | | NULL | |
| Price |
float(8,2)
| YES | | NULL | |
| SortFactor |
int(4)
| YES | | 500 | |
| Availability |
tinyint(1)
| NO | | 1 | |
| OutOfStock |
tinyint(1)
| NO | | 0 | |
| ShipFlatFee |
float(5,2)
| NO | | 10.00 | |
| ShipPercentPrice | tinyint(2)
unsigned
| NO | | 5 | |
| ShipPercentWeight | tinyint(2)
unsigned
| NO | | 2 | |
| pic0 |
mediumblob
| YES | | NULL | |
| pic1 |
mediumblob
| YES | | NULL | |
| sizes |
set('Extra-small','Small','Medium','Large','XLarge','XXLarge ','XXXLarge')
| YES | | NULL | |
| colorsShadesNumbersShort |
set('blue:333399','gray:465945','purple:50404D','navy-blue:C C7722','fuchsia:FF77FF','aqua:7FFFD4','maroon:B03060','black :0000FF','yellow:9ACD32')
| YES | | NULL | |
+--------------------------+-------------------------------- ------------------------------------------------------------ -------------------------------------------------------+---- --+-----+---------+----------------+
17 rows in set (0.00 sec)
The following insert chokes when I try to insert multiple values from the
sets:
insert into products (SKU, Category, Name, Title, Description, Price,
SortFactor, Availability, OutOfStock, ShipFlatFee, ShipPercentPrice,
ShipPercentWeight, sizes, colorsShadesNumbersShort) values("prodSKU1",
"prodCat1", "name1", "title1", "descr", "12.34", "500", "1", "0", "10.00",
"5", "2", "Extra-small", "'aqua:7FFFD4', 'blue:333399'");
mysql> show warnings;
+---------+------+------------------------------------------ ---------------------+
| Level | Code |
Message |
+---------+------+------------------------------------------ ---------------------+
| Warning | 1265 | Data truncated for column 'colorsShadesNumbersShort' at
row 1 |
+---------+------+------------------------------------------ ---------------------+
1 row in set (0.00 sec)
Please advise.
TIA,
Victor
--
The Logos has come to bear
http://logos.13gems.com/
--001636417335fad3ff047c1f76e0--