--存储过程中执行带输出参数的动态SQL

declare @sql nvarchar(max)
declare @tableName varchar(200)
declare @id int

set @tableName='tableA'

set @sql = 'select @id=id from ' + @tableName

exec sp_executesql @sql, N'@id int output', @id output

select @id

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2021-07-01
  • 2021-08-27
相关资源
相似解决方案