For Using sp_executesql with param definition and output parameter
If anyone wants to output value with param definition , by below it can be done.
SET @SQLString = N’SELECT @UserIDOUT = ‘ + @ModifiedByColumn + ‘
FROM #ins’;
SET @ParmDefinition = N’@UserIDOUT NVARCHAR(100) OUTPUT’;
EXECUTE sp_executesql @SQLString, @ParmDefinition, @UserIDOUT=@USERID OUTPUT;
Leave a Reply