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 / how to assign null val...
Power Automate
Unanswered

how to assign null value in Insert Row (V2) for MS SQL server by using if statement

(0) ShareShare
ReportReport
Posted on by 36

Hi,

 

How can I assign null to a varchar field in MS SQL using "Insert Row (V2)" action by checking a condition.

 

In the below example, I have a simple table (WCC_Testing) having 2 data fields. 

KinsonLam_0-1719282420616.png

 

 

When I directly put @{null} in the data field, it is correctly assigned NULL into the table.

KinsonLam_1-1719282420798.png

 

KinsonLam_2-1719282420586.png

 

 

However, if I use @{if()} to evaluate and then assign null, it inserts empty string rather than NULL to the table. 

If this case, I have a variable 'vTest' with initial value @{null}, then in the insert row action, I put @{

if (empty(variables('vText')), null, variables('vText'))}, trying to assign null to the datafield.  However, it is not a NULL in database but empty string.

KinsonLam_3-1719282420793.png

 

KinsonLam_4-1719282420611.png

 

 

I would like to put NULL in database base on the evaluation result in the if statement.  What's wrong and how to fix it?

 

Thanks for any help.

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    Hi , @Kinson-Lam 

    As i test it in my side , i use the same expression as yours.

    vyueyunmsft_1-1719283899915.png

     

    It can work in my side , can you try to convert to the classic mode in Power Automate and re-create a action and try again?

    vyueyunmsft_0-1719283777835.png

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

  • Kinson-Lam (WCC) Profile Picture
    36 on at

    Hi, Zhang,

     

    I have switched back to classic mode as below,

    KinsonLam_0-1719378474885.png

     

    However, after run, the TestCode is still not NULL in database after using the if-statement.  But it will be NULL is I assign @{null} directly.  Any idea?

    KinsonLam_1-1719378553689.png

     

    Any idea?

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard