select
stuff(
(select ‘, <‘ + name + ‘>‘
from sys.databases
where database_id > 4
order by name
for xml path(‘‘), type
).value(‘(./text())[1]‘,‘varchar(max)‘)
, 1, 2, ‘‘) as namelist;
时间: 2024-10-12 07:37:11
select
stuff(
(select ‘, <‘ + name + ‘>‘
from sys.databases
where database_id > 4
order by name
for xml path(‘‘), type
).value(‘(./text())[1]‘,‘varchar(max)‘)
, 1, 2, ‘‘) as namelist;