I have a set of tables with same prefix and same structure. All I need is to “combine” them as one. Basically I retrieve tables with certain pattern from information_schema.tables, then get rid of the last union all. Above method works for 20-30 tables, as the @result won’t exceed the limit for nvarchar. But I’m curious how to get this