Storedprocedure返回Null值 [英] Storedprocedure returns a Null value
本文介绍了Storedprocedure返回Null值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的存储过程:
Hi,
This is My StoredProcedure :
GO
ALTER PROCEDURE [dbo].[uspGetVote](@TeamID INT,@CardID INT)
AS
BEGIN
SELECT AVG(VoteValue) AS [AverageVoteValue] FROM Vote
WHERE TeamID=@TeamID and CardID=@CardID and LastModifiedDateTime between getDate()-7 and getDate()
end
当我执行此程序时,它返回一个null。
请给出正确的代码。
谢谢。
When i execute this procedure its returns a null.
Please give a correct code for that.
Thank you.
推荐答案
你可以提到isnull即
Either you can mention isnull i.e.
SELECT AVG(ISNULL(VoteValue,0)) AS [AverageVoteValue] FROM Vote
WHERE TeamID=@TeamID and CardID=@CardID and LastModifiedDateTime between getDate()-7 and getDate()
或
您可以添加 MUKUL GOEL 所说的条件。
这篇关于Storedprocedure返回Null值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文