UPDATE TABLE Differences between four parts of code

Hi,

I started a new job as a AX Programmer and i have a lot of questions which aren’t exactly answered in web…

My first task is to create a class/job which update a lot of tables from hardcode data…

What are the differences between this four part of code… Because in my develop instance all works perfectly

1

static void Job(Args _args)
{

ARP_HD_Books book;
book.AuthorFirstName = “FIRSTNAME”;
book.insert();

}

2

static void Job(Args _args)
{

ARP_HD_Books book;
select book;
book.AuthorFirstName = “FIRSTNAME”;
book.insert();

}

3

static void Job(Args _args)
{

ARP_HD_Books book;
select forUpdate book;
book.AuthorFirstName = “FIRSTNAME”;
book.insert();

}

4

static void Job(Args _args)
{

ARP_HD_Books book;
ttsBegin;
select forUpdate book;
book.AuthorFirstName = “FIRSTNAME”;
book.insert();
ttsCommit;

}

First u learn about SQL query and use debugger then u can analysis how code executing. see this link msdn.microsoft.com/…/aa883417.aspx

Plss tell ur fields of the table and how many record were present in ur table.

Tell ur Scenario clearly

I have to add record from hardcode data(which will be inside Job/Class, i know this is !BestPractise but i have to do this)…
I read a lot of forums and blogs and there are examples in various possibilities… I tried several and didn’t see any differences…
This is the reason of my post :slight_smile:
Know i found that in:

1 ### Creates a new record with only AuthorFirstName filled ‘FIRSTNAME’, and all other fields blank

2 ### Creates a new record with only AuthorFirstName filled ‘FIRSTNAME’, and all other fields having the same value as the first record in the same table.

3,4 ### the ttsBegin, ttsCommit is only for Update/Delete command…