kan*_*oid 7 linq sql-server asp.net entity-framework-4
我可以像在.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.BranchName,CustomerBranch.Longitude,CustomerBranch.Latitude,CustomerBranch.Telephone,CustomerBranch.CategoryID,CustomerBranch.Description
FROM CustomerBranch WHERE FREETEXT(*,@keyword)
)
Run Code Online (Sandbox Code Playgroud)
存储过程:
ALTER PROCEDURE USP_locationSearch
(@keyword varchar(10))
AS
BEGIN
SELECT * from dbo.fn_locationSearch(@keyword)
END
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11175 次 |
| 最近记录: |