MSSQL 儲存過程中的引數傳遞應用
阿新 • • 發佈:2019-01-01
CREATE PROCEDURE [APPI_ShowPrice]
@fitNo varchar(5),
@AsianNo varchar(5),
@Ahotel varchar(10),
@date1 datetime,
@date2 datetime,
@Aprice varchar(4)
AS
SELECT APPI_PRICE_DATE.PRICE_DATE, APPI_PRICE_DATE.PRICE_G, APPI_PRICE.Ahotel,
APPI_PRICE.Ano, APPI_PRICE.Aprice, APPI_PRICE.Atax, APPI_PRICE.AfitOrGroup,
APPI_PRICE.AasianOrOthers
FROM APPI_PRICE INNER JOIN
APPI_PRICE_DATE ON APPI_PRICE.Aflag = APPI_PRICE_DATE.PRICE_G
WHERE (APPI_PRICE.AfitOrGroup = rtrim(@fitNo)
AND (APPI_PRICE.Ahotel = rtrim(@Ahotel)) AND
(APPI_PRICE_DATE.PRICE_DATE >= CONVERT(DATETIME,
@date1) AND
APPI_PRICE_DATE.PRICE_DATE <= CONVERT(DATETIME,@date2)) AND (APPI_PRICE.Ano = rtrim(@Aprice))
ORDER BY APPI_PRICE_DATE.PRICE_DATE
GO