aneilg
asked on
sql function
i am trying to create the following sunction but i get an error, near the begin.
USE ReportServer
/****** Object: StoredProcedure [ExecutionLogReport] Script Date: 02/07/2012 11:14:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE FUNCTION [dbo].[rptListReportingDat aSources]
(@DataSourceID uniqueidentifier)
BEGIN
SET NOCOUNT ON
SELECT
cast(null AS uniqueidentifier) AS DataSourceID
, 'All' AS DataSourceName
UNION ALL
SELECT
ItemID
, [Name]
FROM
ReportServer.dbo.Catalog dscat WITH (NOLOCK)
WHERE
[Type] = 5
return @DataSourceID
END
GO
USE ReportServer
/****** Object: StoredProcedure [ExecutionLogReport] Script Date: 02/07/2012 11:14:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE FUNCTION [dbo].[rptListReportingDat
(@DataSourceID uniqueidentifier)
BEGIN
SET NOCOUNT ON
SELECT
cast(null AS uniqueidentifier) AS DataSourceID
, 'All' AS DataSourceName
UNION ALL
SELECT
ItemID
, [Name]
FROM
ReportServer.dbo.Catalog dscat WITH (NOLOCK)
WHERE
[Type] = 5
return @DataSourceID
END
GO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
partly answered.
Sorry! I was out for sometime.
In future questions, for better and quicker response please post the ways you tried to solve this issue and also post the error message you received (this is important).
Raj
In future questions, for better and quicker response please post the ways you tried to solve this issue and also post the error message you received (this is important).
Raj
ASKER
RETURNS uniqueidentifier
but get an error on the select.