You could either use parameters as suggested or select into a new tablrvariable and then make the last line of the procedure select all from the table variable.
Thank you! but I'm not using Visual Studio for SQLDataReader. I can't use a @table_var or there is way to get the two tables in a @table_var and next divide them, I have to do it from a store procedure.
This is my problem:
insert into #MyTemp
exec sp
sp is returning two different tables in its structure, any idea of how to resolve it?
Richard Emanuel Masaya Amézquita
Enginner in systems and computers sciences
I have looked into this for ages. I cannot find a way to read out two selects from one procedure into another. The suggested advice is to combine the multiple selects in the source SP into one 'UNION'ed
table and then un-union it all in the target SP. You can pull apart two selects in ASP.NET using the SQL Data Reader but as you have said this is not to be run in the ASP.Net application but in the SQL server side of things. Considering this fact have you
thought of posting your question on the
Transact SQL Forum?
rema43001
Member
28 Points
38 Posts
HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 07, 2012 07:13 PM|LINK
There is a way to execute this Stored Procedure on SQL TRANSACT expecting only the SELECT 1?
CREATE PROC MyProcName
AS
SELECT 1;
SELECT 2;
Thanks.
Enginner in systems and computers sciences
MetalAsp.Net
All-Star
112168 Points
18255 Posts
Moderator
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 07, 2012 07:29 PM|LINK
UselessChimp
Member
210 Points
110 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 07, 2012 09:38 PM|LINK
rema43001
Member
28 Points
38 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 07, 2012 10:37 PM|LINK
Thanks! but I can't modify the sp to add the parameter, seems that doesn't exist a way.
Enginner in systems and computers sciences
tgyoga
Contributor
2266 Points
377 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 08, 2012 11:50 AM|LINK
You can achieve this using SQLDataReader as described below:
http://support.microsoft.com/kb/311274?wa=wsignin1.0
Yoga
rema43001
Member
28 Points
38 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 08, 2012 04:37 PM|LINK
Thank you! but I'm not using Visual Studio for SQLDataReader. I can't use a @table_var or there is way to get the two tables in a @table_var and next divide them, I have to do it from a store procedure.
This is my problem:
insert into #MyTemp
exec sp
sp is returning two different tables in its structure, any idea of how to resolve it?
Enginner in systems and computers sciences
tgyoga
Contributor
2266 Points
377 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 09, 2012 08:05 AM|LINK
What does yoour @MyTemp hold after
insert into #MyTemp
exec sp
?
Yoga
RameshRajend...
Star
7983 Points
2099 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 09, 2012 08:06 AM|LINK
http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/42965;pt=42726
UselessChimp
Member
210 Points
110 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 10, 2012 08:24 PM|LINK
I have looked into this for ages. I cannot find a way to read out two selects from one procedure into another. The suggested advice is to combine the multiple selects in the source SP into one 'UNION'ed table and then un-union it all in the target SP. You can pull apart two selects in ASP.NET using the SQL Data Reader but as you have said this is not to be run in the ASP.Net application but in the SQL server side of things. Considering this fact have you thought of posting your question on the Transact SQL Forum?
rema43001
Member
28 Points
38 Posts
Re: HOW TO EXECUTE THE STORED PROCEDURE EXPECTING ONLY THE FIRST TABLE.
Nov 12, 2012 03:00 AM|LINK
Thanks, finally I got the authorization to modify the sp adding parameters, thanks for all your help.
Enginner in systems and computers sciences