如何使用第二个存储过程将数据插入临时表
亲爱的专家,
我对MSSQL查询有疑问。 ..
我有两个存储过程。第一个是A,第二个是B
当我执行存储过程时A然后它检索3个表。
存储过程B需要执行第一个存储过程中的存储过程B。并将第二个表插入临时表。
我该怎么做。请帮帮我..
谢谢,
Dileep .. 。
Dear Experts,
I have a doubt in MSSQL Query. ..
I have two Stored Procedure. First one is "A" and Second one is "B"
When i Execute the stored procedure "A" then it retrieves 3 Tables.
And the stored procedure "B" need to execute the first Stored procedure within the stored procedure "B". And insert the second table into a temporary table.
How can i do it. please help me..
Thanks,
Dileep...
您好,
您可以使用以下方式将存储过程的结果插入临时表:
Hi,
You can insert result of a stored procedure to temp table using below way:
Insert into #Temp
(
Col1,
Col2,
Col3
)
Exec A
请确保存储过程结果中的列数匹配,以及insert语句中的列。
如果按上述方式执行,如果存储过程A将返回3个表,则它将合并所有3个表的结果。
我不确定是否可以只插入结果的第二个表。我认为这是不可能的。
如果您对此有任何疑问或疑问,请与我们联系。
谢谢
Advay Pandya
Please make sure to have matched number of columns in stored procedure result and columns which are there inside insert statement.
If you execute on the above way and if stored procedure "A" will return 3 tables then it will combine result of all the 3 tables.
I am not sure is it possible to insert only second table of the result. I think it is not possible.
Please let me know if you have any concern or query on this.
Thanks
Advay Pandya