“Data too long for column” - why?

前端 未结 12 698
Happy的楠姐
Happy的楠姐 2020-12-12 19:47

I\'ve written a MySQL script to create a database for hypothetical hospital records and populate it with data. One of the tables, Department, has a column named Description,

12条回答
  •  臣服心动
    2020-12-12 19:57

    For me, I defined column type as BIT (e.g. "boolean")

    When I tried to set column value "1" via UI (Workbench), I was getting a "Data too long for column" error.

    Turns out that there is a special syntax for setting BIT values, which is:

    b'1'
    

提交回复
热议问题