选择sq server 2005的查询 [英] select query for sq server 2005
本文介绍了选择sq server 2005的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果结果值为null,如何在select查询中将值设为0而不是null。
how to get the value as 0 instead of null in select query if the result value is null.
推荐答案
在select语句中使用此项:
Use this in your select statement :
CASE WHEN FieldName IS NULL OR FieldName=''
THEN 0
Else FieldName
End
Pls,接受回答并投票解决问题。
Pls, Accept as answer and vote if solve your problem.
试试这个... :)
Try this ...:)
SELECT ISNULL(CAST(NULLIF(ColumnName, 'NULL') AS int), 0)
FROM TableName
使用此选项。希望它有所帮助
ISNULL(FIELD_NAME,0)
Use this. Hope it helps
ISNULL(FIELD_NAME,0)
这篇关于选择sq server 2005的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文