Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ipkus
Frequent Visitor

How to run Multiple SQL commands in Fabric Pipeline

We are executing a pipeline that bring data from On Prem.

 

The steps require to execute the following steps in 1 session

1 ) Run SP which populates a global temp table

2)  Access data from the temp table and populate that in Lakehouse.

NOTE : We can not run these two SQL seperately because it will run via seperate session and temp table will not be accesible. 

 

example: 

call sp( param1, param2 );

select * from global_temp_table1;

 

If any of you have implemented this in Fabric pipelines, do share your thoughts.

1 ACCEPTED SOLUTION
FabianSchut
Super User
Super User

Hi,

A Table-valued UDF may work better than a Stored Procedure in this case. You can query the results immediately without using a temporary table. You can run just one SQL query then. I'm not sure whether you are able to modify the source to change the stored procedure to a UDF, but here's an example of a UDF (from https://learn.microsoft.com/en-us/answers/questions/1291176/how-to-call-stored-procedure-and-stored-...)
CREATE FUNCTION CustomersByRegion
(
@RegionID int
)
RETURNS TABLE
AS
RETURN
SELECT *
FROM customers
WHERE RegionID = @RegionID
GO

View solution in original post

1 REPLY 1
FabianSchut
Super User
Super User

Hi,

A Table-valued UDF may work better than a Stored Procedure in this case. You can query the results immediately without using a temporary table. You can run just one SQL query then. I'm not sure whether you are able to modify the source to change the stored procedure to a UDF, but here's an example of a UDF (from https://learn.microsoft.com/en-us/answers/questions/1291176/how-to-call-stored-procedure-and-stored-...)
CREATE FUNCTION CustomersByRegion
(
@RegionID int
)
RETURNS TABLE
AS
RETURN
SELECT *
FROM customers
WHERE RegionID = @RegionID
GO

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

Top Solution Authors