I've got a SQL UDF that I need to define both WITH SCHEMABINDING and WITH EXECUTE AS OWNER on. I've tried a number of combinations including listing the WITH keyword twice, trying various methods of concatenation or operators, etc, and haven't had a lot of luck.
Can anybody help me with how to define multiple WITH statements in a single UDF
CREATE FUNCTION [dbo].[Func_PullFolderIdsForUser](@companyId [int], @userId [int])
RETURNS @folders TABLE (
[FolderID] [int] NULL,
) WITH SCHEMABINDING
AS 开发者_Go百科
BEGIN
Comma delimit them. e.g.
CREATE FUNCTION [dbo].[Func_PullFolderIdsForUser](@companyId [INT], @userId [INT])
RETURNS @folders TABLE (
[FolderID] [INT] NULL
) WITH SCHEMABINDING, EXECUTE AS SELF
AS
BEGIN
INSERT INTO @folders VALUES(1)
RETURN
END
精彩评论