Simply put, I am getting a single value from a temp table and assigning it to a variable.
I want to use that variable as a parameter within a call to another stored procedure. But it's not working. It is not syntax.
I get '0 rows affected'. The comments in my code list what works and what doesn't.
DECLARE @CID VARCHAR(10);
SET @CID = (SELECT TOP 1 CID FROM #ChangeTracking)
-- SELECT @CID -- THIS WORKS FINE!
EXEC [master].[dbo].[GetInfo] @CID; -- THIS DOES NOT WORK!
-- EXEC [master].[dbo].[GetInfo] '4832712'; -- THIS WORKS FINE!
How can I get EXEC [master].[dbo].[GetInfo] @CID; to work?