declare @i int; declare @s nvarchar(max) set @i=0; set @s=‘xxxx‘; select @i=count(*) from A where tiaoma=@s; if(@i>0) begin select * from A where tiaoma=@s; end; else begin select @i=count(*) from B where tiaoma=@s; IF(@I>0) BEGIN select * from B where tiaoma=@s; END ELSE BEGIN select @i=count(*) from c where tiaoma=@s; IF(@I>0) BEGIN select * from c where tiaoma=@s; END else begin print(‘没有找到‘) end END end