sql2008設(shè)置subcategory報(bào)表參數(shù)可用值和默認(rèn)值步驟

字號:


    1.在“報(bào)表數(shù)據(jù)”窗格的“參數(shù)”文件夾中,右鍵單擊 Subcategory,然后單擊“參數(shù)屬性”。
    2.單擊“可用值”。
    3.單擊“從查詢中獲取值”。
    4.在“數(shù)據(jù)集”下拉列表中,單擊 SubcategoryValues。
    5.在“值”字段中,單擊 Subcategory。
    6.在“標(biāo)簽”字段中,單擊 Subcategory。
    7.單擊“默認(rèn)值”。
    8.單擊“從查詢中獲取值”。
    9.在“數(shù)據(jù)集”下拉列表中,單擊 SubcategoryValues。
    10.在“值”字段中,單擊 Subcategory。
    11.單擊“確定”。
    接下來,創(chuàng)建取決于 @Category 值和 @Subcategory 值的 @Product 參數(shù)。
    為報(bào)表參數(shù) Product 添加值數(shù)據(jù)集
    1.在“報(bào)表數(shù)據(jù)”窗格中,右鍵單擊 AdventureWorks_Ref,然后單擊“添加數(shù)據(jù)集”。
    2.在“名稱”中,鍵入 ProductValues。
    3.將以下查詢文本粘貼到“查詢”窗格中:
    代碼如下:
    SELECT DISTINCT P.Name AS Product
    FROM Production.Product P
       INNER JOIN Production.ProductSubcategory AS PSC
       ON P.ProductSubcategoryID = PSC.ProductSubcategoryID
       INNER JOIN Production.ProductCategory AS PC
       ON PC.ProductCategoryID = PSC.ProductCategoryID
    WHERE (PC.Name = (@Category)
       AND PSC.Name = (@Subcategory))
    4.單擊“確定”。
    此時,將向“報(bào)表數(shù)據(jù)”窗格添加包含一個 Product 字段的 ProductValues 數(shù)據(jù)集。