Redian新闻
>
How to replace 0 with empty?
avatar
How to replace 0 with empty?# Database - 数据库
n*u
1
old_table has column "ICQ", type is varchar.
Well ICQ number is always int type.
So when I created new_table, I specified ICQ as int.
Then I insert old_table into new_table,
in new_table, the ICQ becomes 0 if it's empty in Old_table
Can I make ICQ empty in new_table?
avatar
B*g
2
do you have default value?

【在 n****u 的大作中提到】
: old_table has column "ICQ", type is varchar.
: Well ICQ number is always int type.
: So when I created new_table, I specified ICQ as int.
: Then I insert old_table into new_table,
: in new_table, the ICQ becomes 0 if it's empty in Old_table
: Can I make ICQ empty in new_table?

avatar
n*6
3
int empty? 是不是null?
oracle default value都是null。
sql server varchar的default value我看到都是null。int的default value可能也是null。
你可能设置了default value为0。(未经过测试)
avatar
j*n
4
try to use CASE statement when you do insert...select...
avatar
c*c
5
int只有null(你所说的empty)。
create 完 new table后,update 所有 0 to null。

【在 n****u 的大作中提到】
: old_table has column "ICQ", type is varchar.
: Well ICQ number is always int type.
: So when I created new_table, I specified ICQ as int.
: Then I insert old_table into new_table,
: in new_table, the ICQ becomes 0 if it's empty in Old_table
: Can I make ICQ empty in new_table?

avatar
n*u
6
Thanks for all your reply.
I found out some ICQ records in old table look like xxx-xxx-xxx. So I might
stick with old type (varchar)
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。