Thanks for the answer, it makes sense.
I need to use it to pass the result into a variable.
;WITH CTE_Test (ID)
AS
(
SELECT CAST(id AS VARCHAR(60)) FROM cat_transaction
EXCEPT
SELECT ext_reference FROM Patricia.dbo.BUDGET_LINE
)
;
SET @Total = (
Select
COUNT(ID)
FROM
CTE_Test
)
Is this possible at all?