sql-server – create function必须是批处理中唯一的语句
发布时间:2020-12-12 07:47:29 所属栏目:MsSql教程 来源:网络整理
导读:我从函数中得到这个错误: CREATE FUNCTION getLavel(@id int,@lavel char)RETURNS dateBEGIN DECLARE @date date select @date = (select authorization_date from Authorized WHERE diver_number = @id and @lavel =level_name) return @dateENDGO 可能是什
我从函数中得到这个错误:
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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |