Home > Forum > Data sources > Stored Procedure as Datasource

Stored Procedure as Datasource
0

Hello.

Is there a way to use a stored procedure as datasource instead of a view or table or Select statement?

I use at the moment a query on two tables (UNION) which has an inner join on another table. The speed is not really breathtaking, thus I wanted to use a stored procedure where I can perform all the timetaking steps already on the SQL server.

Regards
Klaus

MVP

Hi Klaus,

maybe you can change your procedure to a table-valued function, than you could easily use it in an select statement.
An example using one of the provided table-valued functions in the BPS content db:
select item
from dbo.SplitToTable('a,b,c,d',',')

Otherwise you could test this approach, which I didn't test myself.
http://www.techbrothersit.com/2014/08/tsql-how-to-execute-stored-procedure-in.html

Best regards,
Daniel