Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - SQL's simplest column conversion
SQL's simplest column conversion

set nocount on ;

declare @T table(ID int)

insert @T select 1

insert @T select 2

insert @T select 3

insert @T select 4

insert @T select 5

insert @T select 6

p>

insert @T select 7

insert @T select 8

insert @T select 9

insert @T select 0

;with c

as

(

select

row=(row_number()over(order by (select 1 ))-1)/5,* from @T)

select

ID=(select rtrim(ID) from c where row=a.row for xml path('' ))

from C a

group by row

ID

------------- ----------

12345

67890