如一串数字“3,43,23,64,234,76,5,9,14,27”进行排序输入到空表A中。
要求在表A中的排列方式如下:
num
3
5
9
14
23
27
43
64
76
234
******************************************************************************
create proc wsp
@sql varchar(1000)
as
create table #temp(num int)
set @sql='insert into #temp select '+replace(@sql,',',' d union all select ')
exec(@sql)
insert into a select * from #temp order by num
然后调用:
exec wsp'3,43,23,64,234,76,23,5,9,14,27'
转载于:https://www.cnblogs.com/edidu/archive/2007/12/13/993887.html