求拆列?
spidF99F37F87F64F54F90F16F71F17F05F44F78F11F15F14F57F28F98F97F69F35
SPH000311482552252222223210222222
SPH000311832552252222223210222222
SPH0003116951055553553555310252235
SPH00031179252222222222227222222
SPH0003118031052252522255310522224
SPH000311722552252222223210222222
SPH000311552552252222223210222222
SPH000311702552252222223210222222
SPH00031165510103353553355310553333
SPH000311642552252222223210222222
SPH000311632552252222223210222222
SPH00031166510103353553355310553333
SPH00031167102010101010101010551010102010105555
SPH00031145252222220002225220222
SPH00031146121001110000102000000
SPH0003115331052252522255310522224
SPH00031154510103353553355310553333
SPH00031177252222222222227222222
SPH000311782552252222223210222222
SPH00005106252222222222227222222
SPH00005107510103353553355310553333
SPH00031147252002010002225220001
SPH0003114931052252522255310522224
SPH0003115031052252522255310522224
SPH000311512552252222223210222222
SPH00031152510103353553355310553333
SPH000308452552252222223210222222
SPH0003116031052252522255310522224
SPH0003115931052252522255310522224
SPH000311822552252222223210222222
SPH000311572552252222223210222222
SPH00031158510103353553355310553333
SPH0003115610201055555555551020555555
SPH00031162510103353553355310553333
SPH0003117151010335351033105318553335
SPH00031181252000022002005000000
SPH00031175252222222222227222222
SPH0003117631052252522255310522224
SPH00031186510103353553355310553333
SPH00031187510103353553355310553333
SPH00031188510103353553355310553333
SPH00031189510103353553355310553333
SPH0003119051053353533335310533334
SPH00031191510103353553355310553333
[解决办法]
select 'F99',spid,F99 from tbuion allselect 'F37',spid,F37 from tb uion allselect 'F87',spid,F87 from tb uion allselect 'F64',spid,F64 from tb uion allselect 'F54',spid,F54 from tb uion allselect 'F90',spid,F90 from tb uion allselect 'F16',spid,F16 from tb uion allselect 'F71',spid,F71 from tb uion allselect 'F17',spid,F17 from tb uion allselect 'F05',spid,F05 from tb uion allselect 'F44',spid,F44 from tb uion allselect 'F78',spid,F78 from tb uion allselect 'F11',spid,F11 from tb uion allselect 'F15',spid,F15 from tb uion allselect 'F14',spid,F14 from tb uion allselect 'F57',spid,F57 from tb uion allselect 'F28',spid,F28 from tb uion allselect 'F98',spid,F98 from tb uion allselect 'F97',spid,F97 from tb uion allselect 'F69',spid,F69 from tb uion allselect 'F35',spid,F35 from tb
[解决办法]
--假设表名:sptabledeclare @sql varchar(8000) set @sql=''select @sql=@sql+' select '''+name+''' as col1,spid as col2,'+name+' as col3 from sptable union all'from syscolumns where id=object_id('sptable') and name<>'spid'select @sql=left(@sql,len(@sql)-9)exec(@sql)