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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Update_recordset throwing Error converting data type nvarchar to bigint.

(0) ShareShare
ReportReport
Posted on by 302

Hello Everyone,

I am getting this strange error when I am using update_recordset to update the table, Kindly help me what I am missing.

update_recordset tablename
            setting 
                stringfieldname = parameterTable.stringField   tablename2.stringfield   ","
            join tablename2
                where tablename2.stringField2 == tablename.stringfieldname;

The strange part is it is working when I remove "," in the setting statement but if I add any string it is throwing me the following error,

session 5120 (Admin)
UPDATE T1 SET stringfieldname =((? T2.stringfield) ?),RECVERSION=? FROM tablename T1 CROSS JOIN tablename2 T2 WHERE (T1.PARTITION=5637144576) AND ((T2.PARTITION=5637144576) AND (T2.stringfield2=T1.stringfieldname))
[Microsoft[ODBC Driver 17 for SQL Server[SQL ServerError converting data type nvarchar to bigint.
Object Server Azure:
Cannot edit a record in table name (tablename). Reference: 0. The SQL database has issued an error.

PS: I have already tried full db sync. please help me what I am doing wrong.

I have the same question (0)
  • Wekey Profile Picture
    302 on at

    Another strange thing is even the below code works,

    update_recordset tablename
                setting 
                    stringfieldname = parameterTable.stringField   tablename2.stringfield
                join tablename2
                    where tablename2.stringField2 == tablename.stringfieldname;
                    
    update_recordset tablename
                setting 
                    stringfieldname = tablename.stringfieldname   ','
                join tablename2
                    where tablename2.stringField2 == tablename.stringfieldname;

    But it is going to kill the performance updating the same field twice just for adding a new string value which can be performed in a single update_recordset. Just for the clarity.

  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi Wekey,

    Have you tried also something like the next approach?

    private str concatedString = parameterTable.stringField   tablename2.stringfield   ",";
    
    update_recordset tablename
                setting 
                    stringfieldname = concatedString
                join tablename2
                    where tablename2.stringField2 == tablename.stringfieldname;

  • Wekey Profile Picture
    302 on at

    Hello Andre,

    Thanks for the reply.

    I will not be able to do this as the tablename2.stringfield value will not be available. tablename2 is the table I am using in join and the value will be fetched only in the join.

    Thanks

  • Deepak Agarwal Profile Picture
    8,598 on at

    Hi,

    Can you share complete code, how you are getting buffer for parameterTable. can you try to add parameterTable in same query.

  • Wekey Profile Picture
    302 on at

    Hello Deepak,

    please find the entire code,

    Table2           tablename2;
    Table            tablename;
    ParameterTable   parameterTable = ParameterTable::find();
    
    update_recordset tablename
                setting 
                    stringfieldname = parameterTable.stringField   tablename2.stringfield   ","
                join tablename2
                    where tablename2.stringField2 == tablename.stringfieldname;

    I will not be able to add in the query because they have no relations, and it is a parameter table hence I thought we can use find method to fetch the values.

    TIA

  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Can you confirm if these fields are strings? And are these synced successfully to database? Are you able to update the same value from backend database?

  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Also can you confirm if you are getting the parameter table buffer as I am not able to see the value in that SQL error.

  • Wekey Profile Picture
    302 on at

    Hello Bharani,

    Yeah, all the fields are string field, and it is synced to DB successfully. The same value can be updated in backend using SQL. And I am getting the parameter value which is also a string field (Hence It is really matter that it needs a value? However, the value is coming)

    Thanks

  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Have you tried giving setting tablename.fieldname = "thisvalue"? instead of a stringfieldname?

    Also have you tried with simple update statement?

  • Wekey Profile Picture
    302 on at

    Hello Bharani,

    Yeah, I have tried the following still no luck,

    Table2           tablename2;
    Table            tablename;
    ParameterTable   parameterTable = ParameterTable::find();
    
    update_recordset tablename
                setting 
                    stringfieldname = "stringValue"   tablename2.stringfield   ","
                join tablename2
                    where tablename2.stringField2 == tablename.stringfieldname;

    However, when I tried the following code, it is working without throwing an error, but I need to update the table name and not a constant string value,

    Table2           tablename2;
    Table            tablename;
    ParameterTable   parameterTable = ParameterTable::find();
    
    update_recordset tablename
                setting 
                    stringfieldname = "stringValue"   "stringvalue1"   ","
                join tablename2
                    where tablename2.stringField2 == tablename.stringfieldname;

    Thanks

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans