List:General Discussion« Previous MessageNext Message »
From:Thiyaghu CK Date:January 8 2010 7:26am
Subject:Re: Another Inserting Multiple Values with Set Problem
View as plain text  
Hi Victor,

You have given space after the comma(shown here: ('Small, Medium, XSmall')).
Take out the space and try, it will work.

Example:

mysql> insert into products(sizes) values ('Small,Medium,small,medium');
Query OK, 1 row affected (0.05 sec)

Regards,
Thiyaghu CK
www.mafiree.com

On Fri, Jan 8, 2010 at 12:26 PM, Victor Subervi <victorsubervi@stripped>wrote:

> OK, guys, I'm totally confused:
>
> mysql> insert into products (SKU, Category, Name, Title, Description,
> Price,
> SortFactor, Availability, OutOfStock, Weight, ShipFlatFee,
> ShipPercentPrice,
> ShipPercentWeight, sizes, colorsShadesNumbersShort) values ("prodSKU1",
> "prodCat1", "name1", "title1", "descr", "12.34", "500", "1", "0", "2.5",
> "10", "5", "2", "('Small, Medium, XSmall')", "('teal_E2725B, black_0000FF,
> olive_6B8E23, yellow_9ACD32')");
> Query OK, 1 row affected, 2 warnings (0.00 sec)
>
> mysql> show warnings;
>
> +---------+------+---------------------------------------------------------------+
> | Level   | Code |
> Message                                                       |
>
> +---------+------+---------------------------------------------------------------+
> | Warning | 1265 | Data truncated for column 'sizes' at row
> 1                    |
> | Warning | 1265 | Data truncated for column 'colorsShadesNumbersShort' at
> row 1 |
>
> +---------+------+---------------------------------------------------------------+
> 2 rows in set (0.00 sec)
>
> mysql> truncate products;
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> insert into products (SKU, Category, Name, Title, Description,
> Price,
> SortFactor, Availability, OutOfStock, Weight, ShipFlatFee,
> ShipPercentPrice,
> ShipPercentWeight, sizes, colorsShadesNumbersShort) values ("prodSKU1",
> "prodCat1", "name1", "title1", "descr", "12.34", "500", "1", "0", "2.5",
> "10", "5", "2", "('Small', 'Medium', 'XSmall')", "('teal_E2725B',
> 'black_0000FF', 'olive_6B8E23', 'yellow_9ACD32')");
> Query OK, 1 row affected, 2 warnings (0.00 sec)
>
> mysql> truncate products;
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> insert into products (SKU, Category, Name, Title, Description,
> Price,
> SortFactor, Availability, OutOfStock, Weight, ShipFlatFee,
> ShipPercentPrice,
> ShipPercentWeight, sizes, colorsShadesNumbersShort) values ("prodSKU1",
> "prodCat1", "name1", "title1", "descr", "12.34", "500", "1", "0", "2.5",
> "10", "5", "2", "Small, Medium, XSmall", "teal_E2725B, black_0000FF,
> olive_6B8E23, yellow_9ACD32");
> Query OK, 1 row affected, 2 warnings (0.00 sec)
>
> mysql> insert into products (sizes, colorsShadesNumbersShort) values
> ('Large, Small','aqua_7FFFD4, fuchsia_FF77FF');
> Query OK, 1 row affected, 6 warnings (0.01 sec)
>
> mysql> show warnings;
>
> +---------+------+---------------------------------------------------------------+
> | Level   | Code |
> Message                                                       |
>
> +---------+------+---------------------------------------------------------------+
> | Warning | 1364 | Field 'SKU' doesn't have a default
> value                      |
> | Warning | 1364 | Field 'Name' doesn't have a default
> value                     |
> | Warning | 1364 | Field 'Title' doesn't have a default
> value                    |
> | Warning | 1364 | Field 'Description' doesn't have a default
> value              |
> | Warning | 1265 | Data truncated for column 'sizes' at row
> 1                    |
> | Warning | 1265 | Data truncated for column 'colorsShadesNumbersShort' at
> row 1 |
>
> +---------+------+---------------------------------------------------------------+
> 6 rows in set (0.00 sec)
>
> mysql> describe products sizes;
>
>
> +-------+----------------------------------------------------------------------+------+-----+---------+-------+
> | Field |
> Type                                                                 | Null
> | Key | Default | Extra |
>
>
> +-------+----------------------------------------------------------------------+------+-----+---------+-------+
> | sizes |
> set('XSmall','Small','Medium','Large','XLarge','XXLarge','XXXLarge') | YES
> |     | NULL    |       |
>
>
> +-------+----------------------------------------------------------------------+------+-----+---------+-------+
> 1 row in set (0.00 sec)
>
> mysql> describe products colorsShadesNumbersShort;
>
>
> +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+-------+
> | Field                    |
> Type
> | Null | Key | Default | Extra |
>
>
> +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+-------+
> | colorsShadesNumbersShort |
>
>
> set('black_0000FF','yellow_9ACD32','teal_E2725B','olive_6B8E23','green_00A550','white_0F4D92','silver_708090','red_FE2712','lime_32CD32')
> | YES  |     | NULL    |       |
>
>
> +--------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+-------+
> 1 row in set (0.00 sec)
>
> How, o how, do I insert into sets???
> TIA,
> V
>

Thread
Another Inserting Multiple Values with Set ProblemVictor Subervi6 Jan
Re: Another Inserting Multiple Values with Set ProblemVictor Subervi6 Jan
  • Re: Another Inserting Multiple Values with Set ProblemMichael Dykman6 Jan
    • Re: Another Inserting Multiple Values with Set ProblemVictor Subervi6 Jan
Re: Another Inserting Multiple Values with Set ProblemVictor Subervi6 Jan
  • Re: Another Inserting Multiple Values with Set ProblemMichael Dykman6 Jan
    • Re: Another Inserting Multiple Values with Set ProblemVictor Subervi6 Jan
      • Re: Another Inserting Multiple Values with Set ProblemCarsten Pedersen6 Jan
        • Re: Another Inserting Multiple Values with Set ProblemVictor Subervi8 Jan
          • Re: Another Inserting Multiple Values with Set ProblemThiyaghu CK8 Jan
            • Re: Another Inserting Multiple Values with Set ProblemVictor Subervi8 Jan
              • Re: Another Inserting Multiple Values with Set ProblemThiyaghu CK8 Jan
                • Re: Another Inserting Multiple Values with Set ProblemVictor Subervi8 Jan
Re: Another Inserting Multiple Values with Set ProblemVictor Subervi6 Jan