var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: using a storeprocedure in a select statement
i would like to use a storeprocedure as the from clause for a select statement..
select * from exec spGetData
which obviously doesn't work.. anybody know a way i can do this?
You should consider that the 'Select * from' is not necessary because your stored procedure can produce output. If your stored procedure doesn't produce output, you can't make it do so unless you amend the stored procedure.
i need to have this syntax because it is going into a specialist reporting system and that needs the syntax of select feild1, field2 from ...etc
and also it needs to use the same sp as another part of the system.. i'm sure theres a way of "selecting" fields from a dataset returned by a store procedure..
Well, I'm not aware of any method of selecting directly from a stored proc. Maybe there is but I haven't heard about it. What you could do is to direct the output to a temp file and then select from that...
create table #output ( ... )
insert into #output
select * from #output
drop table #output
yeah thats the work around i'm trying now..
cheers for the info..
and if i do find away todo it i'll post it here..
This can be done with a user defined function but not a stored procedure. Here is the example from SQL Books Online:
CREATE FUNCTION fn_CustomerNamesInRegion
( @RegionParameter nvarchar(30) )
SELECT CustomerID, CompanyName
WHERE Region = @RegionParameter
-- Example of calling the function for a specific region
thanks for the reply.. thats the solution i finaly come 2 aswell..