: Is the solution provided below correct?
: What "Passing a variable in a different field" means?
Could you give me examples of its use and when we may need to do something like this?
Interview question text:
"I have a procedure like the following, but it doesn't work:
. solution that doesn't work not included because we already have the solution below
. (please focus on Question 1 and 2 above)
I want to have the field as variable to pass it through a different field. Which part of the is wrong?"
Create Procedure GetFieldPath
Declare @lcSQL varchar(300)
Set @lcSQL ='Select @MyReturnField = ' + @FieldName +' From Customers'
Exec sp_executesql @lcSQL, N'@MyReturnField varchar(10) output',
@MyReturnField = @ReturnField output