I'm trying to return true or false based on a CASE WHEN THEN tsql statement, but the only thing that ever shows up in the results panel is the column name "IsGeneric".
Where am I going wrong?
alter proc Storefront.proc_IsProjectGeneric
@ProjectID INT
AS
SET NOCOUNT ON;
SELECT 'IsGeneric'=CASE WHEN p.[GenericCatalogID] > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END
FROM Storefront.Project p WITH(NOLOCK)
WHERE p.ID = @ProjectID;
SET NOCOUNT OFF;
You are using apostrophes around the identifier, which makes it a string instead.
SELECT IsGeneric = CASE WHEN p.[GenericCatalogID] > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END
FROM Storefront.Project p WITH(NOLOCK)
WHERE p.ID = @ProjectID;