Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010

    Question Unanswered: Need help with query

    I'm kind of an amateur to sql and this site, but I appreciate your help! Im mainly a network admin, but have started doing sql reports using SQL Reporting Services' Report Builder from our SCCM Data. I am using a parameter, called "Product". The report I am working on is for Bentley products. Right now, my drop down box returns the following: Microstation, ServerSelect, All Items, etc. based off this query:

    Select 'All Bentley Products' AS Product
    SELECT SP.DisplayName0 FROM v_GS_Mapped_Add_remove_Programs SP
    WHERE SP.DisplayName0 LIKE 'Bentley%'
    However when, I choose "All Bentley Products" it returns every product installed, such as microsoft updates, adobe products, etc. How do I modify my query so when I choose "All Bentley Products" it only returns everything like "Bentley%"???? Here's my main data query:

    Select SYS.Netbios_Name0, SYS.User_Name0, SP.DisplayName0, SP.Version0, UN.Full_User_Name0, OS.Description0 AS [Owner]
    FROM ((((v_GS_Add_Remove_Programs SP
    JOIN v_R_System SYS on SP.ResourceID = SYS.ResourceID)
    JOIN v_R_User UN on SYS.User_Name0 = UN.User_Name0)
    JOIN v_GS_Operating_System OS ON SYS.ResourceID = OS.ResourceID)
    JOIN v_FullCollectionMembership FCM on SYS.ResourceID = FCM.ResourceID)
    WHERE ((SP.DisplayName0 = @Product OR @Product = 'All Bentley Products') AND FCM.CollectionID = @CollectionID)
    Order by SYS.Netbios_Name0

  2. #2
    Join Date
    May 2005
    South Africa
    Provided Answers: 1
    You are not showing us all your code
    You use variables but it is not defined anywhere
    if the content of @Product is 'All Bentley Products'
    then this condition
    @Product = 'All Bentley Products'
    will be true for all rows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts