I am using a dynamic t-sql string in proc1 to execute proc2, which returns an int variable named @Fatal_Error back to proc1.
When I execute proc2 I use the syntax:
EXEC @SQL @Params
@SQL is the Proc Name (varchar) and @Params is the parameter string (nvarchar).
If I include the @Fatal_Error variable in the dynamic creation of the @Params string the returning value from Proc2 is unable to convert int to nvarchar.
I have declared @Fatal_Error in proc1 as int and tried to add to the end of my dynamic t-sql EXEC but I still get 'Cannot convert int to nvarchar' .
Please help - I'm beginning to pull out hair! :-)
Thanks!
Here' s the syntax I tried when just passing it at the end of the EXEC call:
EXEC @SQL @Param_List = @Fatal_Error
AND I also tried:
EXEC @SQL @Param_List + ' '+@Fatal_Error+' '