简体   繁体   中英

Mysql WorkBench : Default varchar value as empty

Before I started using MySql WorkBench, I was using phpmyadmin and liked to set default values of varchars to empty. So in my code I would not have to check for null values and could only use if $value = '' comparisions. How do I put default value as empty in mysql workbench? If i leave the text box empty unlike phpmyadmin it thinks I do not want any default value.

Thanking you

Imran

Just put two quotes '' in default field for your column.

在 MySql Workbench 中分配一个空字符串作为默认值

Or right-click on a column and choose Default ''

从 MySql Workbench 的上下文菜单中分配一个空字符串作为默认值

The workbench has a bug an fails to update the empty string (it says, no changes). I set it to a space first ' ', and then change the sql code to an empty string ''. That does the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM