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

Community site session details

Session Id :
Power Automate - Power Automate Desktop
Suggested answer

Unable to use Variables with SQL Statements inputting to Access

(1) ShareShare
ReportReport
Posted on by 18
Hello. I am attempting to place variables gotten from my flow onto an Access Database. Whilst doing this, I have been unable to actually add any. No iteration of signs around the variables gets them to work, and I have looked for a while. I may have just been overlooking something or mistyped, but I need help now. 
 
My current code for it is below, but as I have said- it does not work

INSERT INTO ImageBase (Forename)

VALUES

(%'FirstName'%)

Following advice I have found, I have put ' punctuation marks around the variable name, leading to the name of the variable being written into the table- rather than the actual variable insides. Using % signs around it returns a Syntax Error. Any help will be greatly appreciated.

I do have PowerFX enabled for my flow, and below is a screenshot of the actions I'm using to attempt this process. 
 
Categories:
I have the same question (0)
  • Suggested answer
    Sam_Fawzi Profile Picture
    590 Super User 2025 Season 2 on at
    Unable to use Variables with SQL Statements inputting to Access
     
    Try using parameters. Do not put % or quotes around the variable name. In Access/ODBC the placeholder is ?.
     
    INSERT INTO ImageBase (Forename) VALUES (?);
    Parameters (in the action)
    Type: String
    Value: @{variables('FirstName')}  or the dynamic content from your flow
     
    The connector will pass the value and handle quoting. Putting 'FirstName' inserts the literal text FirstName. % is a LIKE wildcard, not a variable marker.
    If you must build the SQL string yourself (not recommended), escape quotes:
    INSERT INTO ImageBase (Forename) VALUES ('@{replace(variables('FirstName'), '''', '''''')}');
    Checks:
    • ImageBase.Forename is Text type.
    • No trailing semicolons or extra lines in the action.
    For multiple fields:
    INSERT INTO ImageBase (Forename, Surname) VALUES (?, ?);

    Add two parameters in order.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 560 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 347 Moderator

#3
Expiscornovus Profile Picture

Expiscornovus 262 Most Valuable Professional

Last 30 days Overall leaderboard