SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Problem with Data truncated for column 'warning' at row 1

    Hi.

    Why I have this error?
    The field `warning` is INT, 10.

    Can u help me?

    PHP Code:
    [SQLINSERT INTO _sharpTbl
    (
     
    ID
    , `warning`
     )
    SELECT
    0
    , CASE WHEN `warning` = ''
    THEN 0
    ELSE `warningEND
    FROM _temp_sharpTbl 

    [Err1265 Data truncated for column 'warning' at row 1 

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    London
    Posts
    163
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what is the data type of column _temp_sharpTbl.warning?

  3. #3
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jurn View Post
    what is the data type of column _temp_sharpTbl.warning?
    Thanks Sir.

    I try with `INT, 10` and `decimal 10, 4` but I have the same error.
    Problem with comma?

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Miguel61 View Post
    Problem with comma?
    yes

    please do a SHOW CREATE TABLE for your table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Thanks Sir.

    I fixed with:

    PHP Code:
    SELECT SUBSTRING_INDEX(`warning`, ','1)x;
    +--------+
    x      |
    +--------+
    25.470 |
    +--------+

    SELECT REPLACE(
                  
    SUBSTRING_INDEX(x','1)
                  , 
    '.',''
                  
    )y;
    +-------+
    y     |
    +-------+
    25470 |
    +-------+
    1 row in set (0.00 sec


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •