SQL Server SP에서 동적으로 이름으로 지정된 로컬 변수의 값을 가져 오는 방법이 있습니까? 그것은 포함하는 범위의 지역 변수에 액세스 할 수 없기 때문에SQL Server SP에서 동적으로 변수 값 가져 오기
declare @foo int
declare @bar int
declare @variable_name varchar(10)
set @variable_name = '@foo'
print -- magic happens here - how to print the value of the variable
-- which name is stored in @variable_name, in this case @foo
평가은 도움이되지 않습니다.
주로 디버깅/진단 목적으로 사용하고 있습니다.
이렇게하면 두 가지 정적 선택이 제한됩니다. 일반 솔루션에 관심이 있습니다. – hvintus