troubleshooting Question

sql server stored procedure parameter

Avatar of pae2
pae2Flag for United States of America asked on
Microsoft SQL Server
10 Comments3 Solutions133 ViewsLast Modified:
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.

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?


Join our community to see this answer!
Unlock 3 Answers and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros