2008 sql server创建的函数老是提示格式错误,求高手解答
发布网友
发布时间:2022-05-25 12:31
我来回答
共3个回答
热心网友
时间:2022-07-11 00:42
CREATE FUNCTION dbo.fn_diagramobjects()--不用输入变量的话你可以用一对括号
RETURNS int
AS
BEGIN
declare @id_dropdiagram int
declare @InstalledObjects int
select @InstalledObjects = 0
if @id_upgraddiagrams is not null --这个变量你没定义,自己在前边定义一下
select @InstalledObjects = @InstalledObjects + 1
return @InstalledObjects
END
追问你的答案也不错,不过人家答得快
热心网友
时间:2022-07-11 00:43
这样试试:
CREATE FUNCTION dbo.fn_diagramobjects
Returns int as
BEGIN
declare @id_dropdiagram int
declare @InstalledObjects int
select @InstalledObjects = 0
if (@id_upgraddiagrams is not null)
select @InstalledObjects = @InstalledObjects + 1
return @InstalledObjects END
go
追问还是不行,谢谢
追答错误信息呢?
热心网友
时间:2022-07-11 00:43
CREATE FUNCTION dbo.fn_diagramobjects(@a varchar(10))
RETURNS int
WITH EXECUTE AS N'dbo'
AS
BEGIN
declare @id_upgraddiagrams int
declare @id_dropdiagram int
declare @InstalledObjects int
select @InstalledObjects = 0
if @id_upgraddiagrams is not null
select @InstalledObjects = @InstalledObjects + 1
return @InstalledObjects
END