急!急!急!关于用户自定义函数的问题???
为什么在用户定义的函数内,GETDATE()函数就不能用了???
create function fnKeHuXiaoShouJingYing
(@timeStyle varchar(1),@dealNo varchar(20),@sortNo varchar(20)=null,@xsth int=0)
returns money
begin
declare @rtValue money
if @sortNo is null
begin
if @timeStyle='d'
begin
select @rtValue=isNull(sum(dsMoney),0) from dealerSale
where datediff(dd,getDate(),selldate)=0
and sellFlag=@xsth and dealNo =@dealNo
end
return @rtValue
end
错误信息:
服务器: 消息 443,级别 16,状态 1,过程 fnKeHuXiaoShouJingYing,行 27
在函数内不正确地使用了 'getdate'。