如何从联接中的另一个表插入时给出列默认值 [英] How Do I Give A Column Default Value While Inserting From Another Table In Joins
本文介绍了如何从联接中的另一个表插入时给出列默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在从另一个表插入列时将默认值设置为NULL ..?
解决方案
使用IsNull或Coalesce设置值为null时的默认值。使用案例..当...其他...结束你要根据现有的非空值设置默认值。
按顺序提出示例代码的问题返回工作代码。
你好,
你可以详细参考这个链接: HTTPS://www.simple -talk.com/sql/t-sql-programming/null-friendly-using-sparse-columns-and-column-sets-in-sql-server/ [ ^ ]
Like giving default value as NULL while inserting column from another table .. ?
解决方案
Use IsNull or Coalesce to set defaults for when a value is null. Use Case.. when... else... end where you want to set defaults based on existing non null values.
Ask a question with sample code in order to be given back working code.
Hello,
You can refer this link in detail : https://www.simple-talk.com/sql/t-sql-programming/null-friendly-using-sparse-columns-and-column-sets-in-sql-server/[^]
这篇关于如何从联接中的另一个表插入时给出列默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文