CREATE proc ft @a varchar(10),@b varchar(10),@re_load varchar(800) output as declare @bb varchar(10) declare @cc varchar(10) declare @RE varchar(800) select @cc=@bselect @bb=b from guanxi where a=''+@a+'' and b=''+@b+'' if @bb is not null begin select @re_load=@bb+isnull(@re_load,'') end else begin select @bb=b from guanxi where a=''+@a+'' set @re_load=isnull(@re_load,'')+@bb set @re=@re_load exec ft @a=@bb,@b=@cc,@re_load=@re end GO
CREATE proc ft @a varchar(10),@b varchar(10),@re_load varchar(800) output as declare @bb varchar(10) declare @cc varchar(10) declare @RE varchar(800) select @cc=@bselect @bb=person2 from guanxi where person1=''+@a+'' and person2=''+@b+'' if @bb is not null begin select @re_load=@bb+isnull(@re_load,'') end else begin select @bb=person2 from guanxi where person1=''+@a+'' set @re_load=isnull(@re_load,'')+@bb set @re=@re_load exec ft @a=@bb,@b=@cc,@re_load=@re end GO
create proc 名 @a int, @b int as select * into #临时表 from guanxi where person1=@a while not exists(select 1 from guanxi where person2=@b) insert #临时表 select * from guanxi where person1 in (select person2 from guanxi) and person1 not in (select person1 from guanxi)select * from #临时表
as
declare @bb varchar(10)
declare @cc varchar(10)
declare @RE varchar(800)
select @cc=@bselect @bb=b from guanxi where a=''+@a+'' and b=''+@b+''
if @bb is not null
begin
select @re_load=@bb+isnull(@re_load,'')
end
else
begin
select @bb=b from guanxi where a=''+@a+''
set @re_load=isnull(@re_load,'')+@bb
set @re=@re_load
exec ft @a=@bb,@b=@cc,@re_load=@re
end
GO
as
declare @bb varchar(10)
declare @cc varchar(10)
declare @RE varchar(800)
select @cc=@bselect @bb=person2 from guanxi where person1=''+@a+'' and person2=''+@b+''
if @bb is not null
begin
select @re_load=@bb+isnull(@re_load,'')
end
else
begin
select @bb=person2 from guanxi where person1=''+@a+''
set @re_load=isnull(@re_load,'')+@bb
set @re=@re_load
exec ft @a=@bb,@b=@cc,@re_load=@re
end
GO
@a int,
@b int
as
select * into #临时表 from guanxi where person1=@a
while not exists(select 1 from guanxi where person2=@b)
insert #临时表 select * from guanxi where person1 in (select person2 from guanxi) and person1 not in (select person1 from guanxi)select * from #临时表
这里有老龟奴zyq_123雍亲正当大版主,还有人称辣花摧魔前青楼名妓smoke当镇小版主,肯定能满足您的需要!!!快来吧~~~~~~