• sgmunson - Wednesday, February 28, 2018 2:37 PM

    I noticed that your query does not identify the data type of the @Grouping variable.  You are testing it for equality with a character string, so if it's a bit data type, you aren't going to get the results you are expecting, as you can't test a bit for 'true' or for 'false', as SQL Server does not recognize those strings as boolean values.    You have to actually test for either 1 or 0 for a bit data type, where 1 is generally true, and 0 is generally false.   On the other hand, if it has a varchar(5) (or longer) data type, and you know that the web app supplies character strings that are either the word true or the word false, you would be okay, but if that app returns a boolean value, it's the problem.

    This is in a sproc, and this variable is a parameter.

    ALTER procedure [dbo].[genSelPeopleGroups]

    @user-id uniqueidentifier,

    @Grouping bit

    as

    ...