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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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