add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
6 rows affected
3 rows affected
SELECT * 
INTO ##newglobaltable -- SELECT the result from the dynamic SQL into temporary table
FROM
(SELECT [order], [name], [nopas]
  FROM ##tablename) AS sourceTable
PIVOT(
MAX([nopas])
FOR [name] IN ([ADAM],[FIKI],[JAMES])
) AS pivotTable;
3 rows affected
ADAM FIKI JAMES
00115301 00149970 00149998
00130015 00142641 null
null 00127700 null