これはおそらくほとんどの人にとって些細なことですが、私はストアド プロシージャを非常に長い間 (6 か月しか) 書いていません。INSERT クエリに使用されている列の 1 つに基づいて、変数 @testid を設定できるようにしたいと考えています。これどうやってするの?
DECLARE @testid INT;
INSERT INTO [exporttestresultreport] (
[testid],
[othercolumn]
)
SELECT
[testid], -- <======= how can I set my variable based on this column?
[othercolumn]
FROM
[exporttestresultreport] e
WHERE
[exporttestresultreportid] = @exporttestresultreportid