Hi @Soroush
these two codes are just for example, it may be 2 codes or 100 codes
Not sure what you mean, do you want result like this:
6262101600808 - 6263017600258 - 6262422500184 - 6261717900081 - ......
If I understand right, then you could use String_agg (SQL Server 2017 (14.x) and later) like this:
Declare @tbl Table (code varchar(20))
insert into @tbl values
('6262101600808'),('6263017600258'),('6262422500184'),('6261717900081')
SELECT STRING_AGG(code,' - ') Code_list
FROM @tbl
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.