title: Why is my data being truncated?
body: <p>I'm relatively new to MySQL/SQL and this is my first post on this site, so I apologize if I phrase this question poorly.</p>
  
  <p>I saved a copy of my .xlsx file as a .csv file. I am trying to load data from that .csv file into a table. I get the following error message: </p>
  
  <blockquote>
    <p>0 row(s) affected, 64 warning(s): 1265 Data truncated for column
    'ptsg' at row 1</p>
  </blockquote>
  
  <p>Error log here: <a href="http://pastie.org/private/byzcwjtslxpfjyhoog2g" rel="nofollow">http://pastie.org/private/byzcwjtslxpfjyhoog2g</a></p>
  
  <p>Query here: <a href="http://pastie.org/private/tyzkbyqnuwpsafrjxcetq#6,8,12-13" rel="nofollow">http://pastie.org/private/tyzkbyqnuwpsafrjxcetq#6,8,12-13</a></p>
  
  <p>I've tried playing with the 'ptsg' column data type, changing it from float, to decimal without luck.</p>
  
  <p>The data that is being inserted into that column is 4 significant figures at most, and takes the form of something like, "100" or "100.2", with at most 1 number proceeding the decimal.</p>
  
  <p>I have other float columns that work fine with data like "0.347." Why is my data being truncated?</p>
  
  <p>Here are three lines of the data in .csv form:</p>
  
  <pre>
  2013Nuggets,2013,1,Denver,Nuggets,Denver Nuggets,82,19705,3145,6613,0.476,662,1704,0.388,1859,2429,0.765,791,2652,3443,1813,605,352,1157,1719,8811,107.5
  2013Knicks,2013,2,New York,Knicks,New York Knicks,82,19780,3140,6867,0.457,765,2081,0.368,1689,2087,0.809,847,2470,3317,1757,625,475,1123,1743,8734,106.5
  2013Rockets,2013,3,Houston,Rockets,Houston Rockets,82,19880,3170,6975,0.454,677,1843,0.367,1668,2083,0.801,962,2549,3511,1955,581,371,1110,1641,8685,105.9
  2013Suns,2013,4,Phoenix,Suns,Phoenix Suns,82,20005,3219,6844,0.47,701,1857,0.377,1472,1939,0.759,821,2478,3299,1945,545,357,1169,1666,8611,105
  </pre>
  
  <p>Output from query: <code>SHOW WARNINGS;</code></p>
  
  <pre>
  Note    1265    Data truncated for column 'ptsg' at row 1
  Note    1265    Data truncated for column 'ptsg' at row 2
  Note    1265    Data truncated for column 'ptsg' at row 3
  Note    1265    Data truncated for column 'ptsg' at row 5
  ...
  </pre>
  
  <p>UPDATE:</p>
  
  <p>Thanks to peterm, I noticed I was using the "decimal" datatype incorrectly for column 'ptsg'. I used DECIMAL(10,0) instead of (10,1). My 64 warnings has been reduced to 1.</p>
  
  <p>0 row(s) affected, 1 warning(s): 1366 Incorrect decimal value: ' ' for column 'ptsg' at row 1246 Records: 1334  Deleted: 0  Skipped: 1334  Warnings: 1</p>
  
  <p>Row 1246 has a blank for ptsg. My query above (specifically, ptsg = NULLIF(@vptsg,'')) <em>should?</em> insert a "NULL" for row 1246 into the ptsg column. I checked the table, and the ptsg column, DECIMAL(10,1), should allow NULL values since I've left the "NN" or "Not Null" checkbox unchecked.</p>
  
  <p>Row 1246 looks like:
  1955Bullets,1955,9,Baltimore,Bullets,Baltimore Bullets,,,,,,,,,,,,,,,,,,,,,</p>
  
  <p>Am I making another silly mistake?</p>