我从函数中收到此错误:
CREATE FUNCTION getLavel(@id int ,@lavel char)
RETURNS date
BEGIN
DECLARE @date date
select @date = (select authorization_date from Authorized WHERE diver_number = @id and @lavel =level_name)
return @date
END
GO
可能是什么原因?
泰非常。
将其转换为内联表值函数。这将比标量函数执行得更好。同样,您不应该对字符数据类型使用默认大小。您知道char的默认长度是多少吗?您知道它会因使用情况而有所不同吗?
CREATE FUNCTION getLavel
(
@id int
, @lavel char --You need to define the length instead of the default length
)
RETURNS table
return
select authorization_date
from Authorized
WHERE diver_number = @id
and @lavel = level_name
GO
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句