能不能把两个存储过程出来的表连接一下呢
能不能把两个存储过程出来的表连接一下呢
比如如下的代码。运行后会出来2个表格。能不能把这两个表格当作普通的查询 来进行 union 或者join 操作呢
注:我这里只是个例子。如果直接一行代码的我就不给分了。我想要:“把两个存储过程出来的表连接一下”
--建立表
Create Table Test
(id Int,name nvarchar(20))
--插入数据
Insert Test Select 1,'a'
Union all Select 1,'b'
Union all Select 2,'c'
Union all Select 3,'d'
Union all Select 4,'e'
GO
--建立存储过程
Create ProceDure P_1
As
select * from Test where id<2
GO
Create ProceDure P_2
As
select * from Test where id>2
GO
--运行
exec P_1
exec P_2
Go
--删除
Drop Table Test
Drop ProceDure P_1
Drop ProceDure P_2