-2
我是SQL Server的新手,目前正在學習它。我有下面的存儲過程,我不明白。將存儲過程轉換爲簡單的T-Sql
-- declare a new TABLE variable
DECLARE @Products TABLE
(RowNumber INT,
ProductID INT,
Name VARCHAR(50),
Description VARCHAR(5000),
Price MONEY,
Image1FileName VARCHAR(50),
Image2FileName VARCHAR(50),
OnDepartmentPromotion bit,
OnCatalogPromotion bit)
-- populate the table variable with the complete list of products
INSERT INTO @Products
SELECT ROW_NUMBER() OVER (ORDER BY Product.ProductID),
Product.ProductID, Name,
SUBSTRING(Description, 1, @DescriptionLength) + '...' AS Description, Price,
Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM Product INNER JOIN ProductCategory
ON Product.ProductID = ProductCategory.ProductID
WHERE ProductCategory.CategoryID = @CategoryID
-- return the total number of products using an OUTPUT variable
SELECT @HowManyProducts = COUNT(ProductID) FROM @Products
-- extract the requested page of products
SELECT ProductID, Name, Description, Price, Image1FileName,
Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM @Products
WHERE RowNumber > (@PageNumber - 1) * @ProductsPerPage
AND RowNumber <= @PageNumber * @ProductsPerPage
請!將上面的存儲過程轉換爲簡單的t-sql語句,以便我獲得這些點。我會非常感謝你的工作。
在此先感謝
是這個家庭作業?如果是這樣,那麼你應該把它標記爲家庭作業。你也應該展示你曾經嘗試過的。 – Taryn
積分?什麼意思? –
這裏沒有人會爲你做你的工作。如果您需要某個特定問題的幫助,請更改您的問題,並告訴我們您已爲此問題付出了一些努力。否則,你根本不可能得到任何幫助。 –