[英]Create db Function in SQL Server
What is my error with explanations please, need to create a table valued function. 请解释我的错误是什么,需要创建一个表值函数。
CREATE FUNCTION [dbo].[RetrieveEntityParent] (@FK_EntityId int (max))
with p as
(SELECT EntityId, FK_ParentId , EntityName ,EntityArabicName
FROM OrgEntity
WHERE OrgEntity.EntityId=14
UNION ALL
SELECT PA.EntityId, PA.FK_ParentId, PA.EntityName,PA.EntityArabicName
FROM OrgEntity as PA
inner join p
ON p.FK_ParentId = PA.EntityId)
SELECT * from p
The syntax for an inline table valued function is: 内联表值函数的语法为:
CREATE FUNCTION [dbo].[RetrieveEntityParent] (@FK_EntityId int (max))
RETURNS TABLE
AS RETURN
... your query here ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.