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
这样试试:
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
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