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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

How to initialize field with constant value using Query::insert_recordset

(1) ShareShare
ReportReport
Posted on by Microsoft Employee
Hi experts,
 
I have a table A that has a field named sessionId.
For some reasons, I have to use Query to insert multiple records into table A.
Some field of table A are mapped with field from other tables.
But for sessionId, I need to set a constant value for it.
 
So is there a way to initialize field sessionId with a constant value using Query::insert_recordset()?
Or I can only insert other fields firstly, and then use update_recordset to set the field sessionId?
 
Thanks.
  • Suggested answer
    Martin Dráb Profile Picture
    240,854 Most Valuable Professional on at
    I suspect you can't use a literal value instead of a field mapping. At least Microsoft thought so when creating RetailTmpCDXNodeConstTable table. It's a TempDB table that they populate with constant values they want in Query::insert_recordset(), add it to the query and use normal field mapping to take values from RetailTmpCDXNodeConstTable insert to the target table. Maybe you can use the same approach.
  • Verified answer
    Kai Cheng Profile Picture
    Microsoft Employee on at
    Now the only way I found is that:
    Insert recordset firstly, then update_recordset for the records just insert with the constant values.
  • Martin Dráb Profile Picture
    240,854 Most Valuable Professional on at
    Your (verified) answer claims that it's impossible and the records must be updated later, while my reply does offer a solution for Query::insert_recordset().

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 111 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 79

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 75 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans