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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anushka96
Frequent Visitor

How to insert dynamic content in a query

I'm trying to dynamicaly create plsql query in copy data node. But I can't use set varaible in that dynamic query as per the suggested method in auto completion. Following statement is my sql statement.

SELECT *
FROM (
    SELECT a.*, CAST(ROWNUM AS INTEGER) AS rnum
    FROM (
        SELECT * FROM DBO.TestData
    ) a
    WHERE ROWNUM <= 2000
)
WHERE rnum >= @variables('LastRow')

My Piplineline is like in the picture.
Anushka96_0-1725014636343.png

 



 

1 ACCEPTED SOLUTION
NandanHegde
Super User
Super User

  • You can use the following dynamic content to build the query. Enclose the parameter within @{...} (string interpolation) wherever required:

    SELECT *
    FROM (
        SELECT a.*, CAST(ROWNUM AS INTEGER) AS rnum
        FROM (
            SELECT * FROM DBO.TestData
        ) a
        WHERE ROWNUM <= 2000
    )
    WHERE rnum >= @{variables('LastRow')}





----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

View solution in original post

1 REPLY 1
NandanHegde
Super User
Super User

  • You can use the following dynamic content to build the query. Enclose the parameter within @{...} (string interpolation) wherever required:

    SELECT *
    FROM (
        SELECT a.*, CAST(ROWNUM AS INTEGER) AS rnum
        FROM (
            SELECT * FROM DBO.TestData
        ) a
        WHERE ROWNUM <= 2000
    )
    WHERE rnum >= @{variables('LastRow')}





----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.