sqlserver the name is not a valid identifier error in function

参考资料: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)

 

posted @ 2019-08-22 18:01  大稳·杨  阅读(1391)  评论(0编辑  收藏  举报