CodeIgniter Forums
database Truncate error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: database Truncate error (/thread-53006.html)



database Truncate error - El Forum - 07-06-2012

[eluser]reghan[/eluser]
Hello I am having issues with my database/codeigniter program


there error I am getting is:

Error Number: 1265

Data truncated for column 'Day2_LostRevenue' at row 1

its when I try and submit a blank into the database.

its set up as follows:

type: float(9,2)
null: yes
default: null

is this happening because its trying to insert null into a column thats a float?

I am just not sure what to do. I would like to be able to insert nothing an have it blank if that makes sense.

Thanks in advance



database Truncate error - El Forum - 07-06-2012

[eluser]InsiteFX[/eluser]
Set a default like 0.00


database Truncate error - El Forum - 07-06-2012

[eluser]reghan[/eluser]
I have set a default:

Day1_LostRevenue float(9,2) Yes 0.00

it still gives me that error, I I cannot insert a blank.


Any other suggestions?

Thankyou!


database Truncate error - El Forum - 07-06-2012

[eluser]InsiteFX[/eluser]
If you do not set it to anything the default will set it to 0.00
If you are dealing with money there should always be a default like 0.00

Change your default from null to 0.00



database Truncate error - El Forum - 07-06-2012

[eluser]reghan[/eluser]
Thanks for the reply.

I have set the money column to

null = no
default = as defined: 0.00

and it still gives me the truncate error:

Error Number: 1265

Data truncated for column 'Day1_LostRevenue' at row 1
for the column that I have set the default to 0.00.

SO I am really unsure what the problem says. I totally agree with your answers, but its just not working.


database Truncate error - El Forum - 07-06-2012

[eluser]reghan[/eluser]
ALTER TABLE `process` CHANGE `Day1_LostRevenue` `Day1_LostRevenue` FLOAT( 9, 2 ) NOT NULL DEFAULT '0.00'

this statement was sucessfull.


database Truncate error - El Forum - 07-06-2012

[eluser]Aken[/eluser]
What is a "blank" that you're trying to insert?


database Truncate error - El Forum - 07-06-2012

[eluser]InsiteFX[/eluser]
This is what I found for this error 1265