我想在我的查询中调用我的 sp,但有 2 个错误:
Msg 156, Level 15, State 1, Line 17
Incorrect syntax near the keyword 'EXEC'.
Msg 156, Level 15, State 1, Line 19
Incorrect syntax near the keyword 'AS'.
这是我的查询:
SELECT O.OrderId
,O.Number
,O.Creation
,(SELECT Name + ' ' + Surname FROM [User] WHERE UserId = (SELECT CreatedBy FROM [User] WHERE UserId = O.UserId) ) AS OrderOwner
,(SELECT Name + ' ' + Surname FROM [User] WHERE UserId = O.UserId )AS Customer
,(SELECT Telephone1 FROM [User] WHERE UserId = O.UserId) AS Telephone
,(SELECT CASE IsActive WHEN 1 THEN 'Indirimli' WHEN 0 THEN 'Indirimsiz' END AS Indirim FROM [User] WHERE UserId = O.UserId) AS Discount
,(SELECT CASE IsActive
WHEN 0
THEN
(SELECT SUM(Price) FROM Product WHERE ProductId IN( SELECT ProductId FROM OrderProduct WHERE OrderId = O.OrderId ))
WHEN 1
THEN
EXEC USP_CalculatePrice 70
END AS Price
FROM [User] WHERE UserId = O.UserID) AS Price
,O.Description
,O.Status
FROM
[Order] AS O
WHERE O.Status = 0
你有什么建议吗?