web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Character Limitation i...
Power Automate
Answered

Character Limitation in SQL Statement or Set variable ?

(0) ShareShare
ReportReport
Posted on by 73

Hello,

 

I do have long query to execute through 'Execute SQL statement'. However, PAD is restricting me to insert the long query statement by showing 'Invalid value'. (I tried the same in 'Set variable' and getting the same issue.

 

Niraj466_0-1672905023662.png

 

This will work if I make the text too shorten.

 

Is there any way to insert the long data in 'SQL statement' or via 'Set variable'?

 

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    Hi @Niraj466 

    Can you check if it is a length issue or if the error is occurring because there are multiple INSERT INTO statements in the same box. If it can hold multiple statements does it need a separator or it cannot accept at all? That way you can figure out what solution you can implement.

     

  • Niraj466 Profile Picture
    73 on at

    Thank you VJR for responding.

    I've already checked this by keeping two rows of INSERT Statements. It is working even though it is multiple INSERT statement.

    Niraj466_0-1672914638418.png

     

  • VJR Profile Picture
    7,635 on at

    Alright, good, so length is not an issue.

    Hope there are no syntax issues in the parameters of all the sql statements.

    If that is fine then you will have to troubleshoot how many characters are allowed.

    You will have to do this by removing the statements and checking whether its accepting or not.

     

    For example 10 Insert into statements are not giving an error. Then add 1 and run and if that gives and error then that will tell the issue with the number of acceptable characters.

     

    Then in that case you will have to run them in a loop with only acceptable number of statements.

     

    Also by the way what are you inserting? Are they records from a spreadsheet? Are those insert statements into the same table or different table?

     

  • Niraj466 Profile Picture
    73 on at

    INSERT data will be coming from JSON format that I'm converting to custom object. Looping this custom object, I can make consolidated list for INSERT statement and that will be updated in SQL statement.

    In looping the INSERT rows individually, it will execute the SQL for number of times and will also time taking process because the actual SQL is already break down in four pieces.

     

    Let me think if can run it for group of 100 INSERT rows, if there will not be any other work around.

     

     

  • Verified answer
    VJR Profile Picture
    7,635 on at

    Convert the json to a datatable, then write that to an Excel or a text file and use a Bulk Insert sql command to insert all rows at once.

    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Bulk-Insert-from-Excel-to-SQl/m-p/1621380/highlight/true#M14888

     

  • Verified answer
    Niraj466 Profile Picture
    73 on at

    Hi VJR,

     

    Write to the text file and read the data from text file and insert in SQL statement as variable works now.

     

    Thank you VJR for the solution provided here. I marked your solution as Accepted.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard