Я пытаюсь преобразовать эту хранимую процедуру с одним входным параметром @feature
, на который будут ссылаться в трех местах оператора select:
create PROCEDURE ProcOrder
@feature NVARCHAR(100)
AS
SET NOCOUNT ON;
SELECT
[Created] AS [Date], [SerialId], [ProductId],
CreatedById AS [UserId]
FROM
[Customer].[dbo].[QuotationFlat] QF
INNER JOIN
[Customer].[dbo].[Product] Pt ON Pt.Status = QF.'+@feature+'
WHERE
'+@feature+' = '1'
AND Productid IN (SELECT Productid
FROM Product
WHERE Productid = (SELECT MAX(Productid)
FROM Product
WHERE ProductName ='+@feature+'))
GO
EXECUTE ProcOrder @feature = N'Month'
go