日期:2014-05-18  浏览次数:20572 次

SQL Server 2005 显示几个字段合并起来的字符串
例如:

select province+city+area+street as address from addressmst where address_id=28

其中province、city、street都有值,但是如果area的值为NULL的话,就会显示为NULL。

如果将为NULL的字段去掉,则显示address有值:
select province+city+street as address from addressmst where address_id=28

------解决方案--------------------
SQL code
select province+city+isnull(area,'')+street as address from addressmst where address_id=28

------解决方案--------------------
isnull(col1,'')+isnull(col2,'')+isnull(col3,'')+isnull(col4,'') 即可