简体   繁体   中英

Calling a stored procedure from a select statement

I am trying to call a stored procedure from a select statement but it isn't working.

Anyone have an idea?

This is my code:

CREATE PROCEDURE [eversuite_localization].[Resource_GetAll] 
AS 
BEGIN       
    SELECT [ResourceId],
           [ResourceKey], 
           EXECUTE  ([eversuite_localization].[Resource_GetResourceValue] ResourceID) ,
           [CultureId],[ClassId],[ResourceType]     
    FROM   [eversuite_localization].[Resource]   
END

You will not be able to do that

You will have to insert it into a temp/variable table first.

Have a look at Insert Values of Stored Procedure in Table – Use Table Valued Function

An alternative is using APPLY and functions

Using APPLY

The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query.

EDIT

from your comment

The stored procedure selects a value from a table

Rather use a scalar function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM