declare @fields varchar(max)
set @fields=(select name+','  from sys.columns where object_id = object_id(N'p.e_LOG_AFSIP_BLOCK_ALL')
and name in (
    select ColName from cfg.Dict_Col 
        where TblID=(select TblID from cfg.Dict_Tbl where TblName='p.e_LOG_AFSIP_BLOCK_ALL')
) for xml path(''))
set @fields='select '+LEFT(@fields,LEN(@fields)-1)+ ' from p.e_LOG_AFSIP_BLOCK_ALL'
print @fields
exec (@fields)

执行语句使用exec (sql)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2021-07-19
  • 2021-05-19
  • 2022-12-23
  • 2021-06-19
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
相关资源
相似解决方案