Hi all,
I am importing some data from a CSV File and then inserting the same into a Table.
Now While inserting I want the program to Stop when the record already exists in the same table.
Please Provide me some sample code ..
*This post is locked for comments
You can write a select statement based on primarykey of your table.
Suppose your Table has PrimaaryKeyABC with one field inside that key you can write something as under
Select firstonly tableNameBuffer
Where tableNameBuffer.FielldNameofPk == _SomeValue;
If(!tableNameBuffer) //if does not exists !
{
//insert
}
Similarly if your Table has a composite primary key, write statement accordingly.
Select firstonly tableNameBuffer
Where tableNameBuffer.Fielld_1_NameofPk == _SomeValue
&& tableNameBuffer. Fielld_2_NameofPk == _someOtherValue;
If(!tableNameBuffer) //if does not exists !
{
//insert
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156