參考資料:https://stackoverflow.com/questions/22008859/the-name-is-not-a-valid-identifier-error-in-function 執行存儲過程中sql字元串: ...
參考資料:https://stackoverflow.com/questions/22008859/the-name-is-not-a-valid-identifier-error-in-function
執行存儲過程中sql字元串:
SET @Name = 'select UserName from [' + @dbName + '].dbo.Users where UserID=' + CONVERT(VARCHAR, @UserID) exec(@Name)