I want to execute a procedure from another procedure for that I want to enter database name dynamically.
SELECT @dname=dbname FROM @db WHERE id=@intFlag
PRINT @dname
EXEC [@dname].[dbo].[IPC_GetCount] @UserLogin,@Role,@Email,@Days,@Code,@Status
But it is not accepting the variable even though I am getting db name inside the variable.
Please help