SELECT @StuId='"'+STRING_AGG(Id,'","')+'"'FROM( SELECT 'a'+cast(Id as varchar) Id from Student) AS TEStudent

可以用以下替代

  set @StuId=STUFF((select ','+Id from ( SELECT 'a'+cast(Id as varchar) Id from Student) as T FOR XML PATH('')),1,1,'')

相关文章:

  • 2022-12-23
  • 2021-12-21
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-10-03
猜你喜欢
  • 2021-08-14
  • 2021-09-11
  • 2021-08-17
  • 2022-12-23
  • 2021-09-29
  • 2021-09-23
  • 2021-11-12
相关资源
相似解决方案