Is it possible to build a SQL Server function that aggregates multiple subquery rows into one delimited string?

Looking for a simple SQL Server solution to replace lengthy cursors with a function that merges subquery rows. For instance:

SELECT v.ID, v.FullName, CombineValues((SELECT l.CityName FROM Locals l WHERE l.RefID = v.ID), '; ') AS Locations
FROM Vehicles v;

hey, i worked with xml path and it done its job quite awsomly! have you encountered issues with char encodng? its not a magic bullet but sure cuts down cursors. what about trying newer techniques like string agg in the latest sql versions?

hey, u might wanna give stuff() with for xml path a whirl over that function. worked good for me in older sql versions, might fix subquery rows issue w/o cursors, though some xml encode quirks may pop up