1
嘿,這裏是我的代碼,我現在有一個存儲Proceedure:TSQL SELECT語句具有@varible
DECLARE @SQL NVARCHAR(MAX);
[more code here.....]
SET @SQL = @ParameterSQL;
[more code here.....]
SET @SQL =
'SELECT
CONCAT(
OBJECT_NAME(@@PROCID),
LEFT(modify_date, 11),
'' ('',
DATEDIFF(day, LEFT(modify_date, 11), GETDATE()),
'' days ago)''
) AS CurrentVersion,
CONCAT(
''@val3'',
''''
) AS calledQuery
FROM
sys.objects
WHERE
type = ''P''
AND
name = ''' + @ver + '''';
EXECUTE sp_executesql @SQL;
沒有錯誤,但在輸出只是顯示了這一點:
_______________________________________
|CurrentVersion |calledQuery|
|-------------------------|-----------|
|May 11 2017 (0 days ago) |@val3 |
因此,@ val3應該是剛纔運行的查詢。
我錯過了什麼?