I am trying to write a SQL statement in a stored procedure, and I'm not sure if SQL has the functionality to handle what I am tring to do.
Once the call is made, I use the @PONum variable in the proc.
Here is my example statement:
SET @SQLString = N'select ' + @PONUM + ' = PONUMBER from ' + @InterID + '.dbo.POP40100
EXEC sp_executesql @SQLString
I am passing the DB name(@InterID) into the proc, and I need to return the PONumber(@PONum).
Is it possible to return a value into the parameter @PONum when using sp_executesql? It seems to handle in params ok, but not out. What can I do?
Once the call is made, I use the @PONum variable in the proc.
Here is my example statement:
SET @SQLString = N'select ' + @PONUM + ' = PONUMBER from ' + @InterID + '.dbo.POP40100
EXEC sp_executesql @SQLString
I am passing the DB name(@InterID) into the proc, and I need to return the PONumber(@PONum).
Is it possible to return a value into the parameter @PONum when using sp_executesql? It seems to handle in params ok, but not out. What can I do?