我可以像在.dbml中一样在我的.edmx文件中添加sql函数吗?如果可以的话,怎么做?如果我不能,是否有任何解决方法?
我试图谷歌,但没有找到任何具体的答案,如何做到这一点.
基于给定的答案,我创建了一个存储过程,并尝试添加“导入函数”,但它表示“存储过程不返回列”.我哪里做错了?
功能:
ALTER FUNCTION [dbo].[fn_locationSearch](@keyword varchar(10)) RETURNS TABLE AS RETURN ( SELECT CustomerBranch.ID,CustomerBranch.BranchName,CustomerBranch.Longitude,CustomerBranch.Latitue,CustomerBranch.Telephone,CustomerBranch.CategoryID,CustomerBranch.Description FROM FREETEXTTABLE (CustomerOffer,*,@keyword) abc INNER JOIN OffersInBranch ON abc.[key]=OffersInBranch.OfferID INNER JOIN CustomerBranch ON OffersInBranch.BranchID=CustomerBranch.ID UNION SELECT CustomerBranch.ID,CustomerBranch.Latitude,CustomerBranch.Description FROM CustomerBranch WHERE FREETEXT(*,@keyword) )
存储过程:
ALTER PROCEDURE USP_locationSearch (@keyword varchar(10)) AS BEGIN SELECT * from dbo.fn_locationSearch(@keyword) END