1. Christian Breu
  2. as Valentina DB Server
  3. Mittwoch, März 27 2019, 11:08 PM
  4.  Abonnieren via E-Mail
[How] is it possible to just update existing records while using vCursor.importText()?
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Can you please update the samples too?
I could not get it to work with 9.1.5
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
is it implemented already?
Kommentar
There are no comments made yet.
Ruslan Zasukhin Akzeptierte Antwort
9.1.5 archive can be found here already:

http://valentina-db.com/download/prev_releases/9.1.5
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Hello Ruslan

Thank you for the info.
What does it mean v9.2 – before/until may 20?
This should be ok.
Kommentar
There are no comments made yet.
Ruslan Zasukhin Akzeptierte Antwort
Hi Christian,

Ivan worked the prev week to improve join, and MERGE

we will ship OR 9.1.5 or 9.2 next week.

IF this is VERY VERY urgent -- let me know, then we will try 9.1.5 asap
if can wait to weekend - then we hope for 9.2 ready
Kommentar
There are no comments made yet.
François Van Lerberghe Akzeptierte Antwort
Hi Christian,

Try with this link code :

ON (isource.artikelnummer = mtarget.artikelnummer AND isource.barcode = CONCAT(mtarget.barcode))
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Hoping for some progress about this topic.
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Thank you Sergey!
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
I added a feature request for JOIN operation which is used in MERGE command.
Referenzen
  1. http://valentina-db.com/bt/view.php?id=8513
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Do I have to set it as a feature request somewhere?
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Hi Sergey

A full implementation of Merge, to work as expected, would be great – save my day...
...and a reason for my customer to update to the latest version of VServer. ;)


Thank you for support.
Best regards.

Chris
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello Christian,

No, it is in the latest versions, too.
It is a limitation of the JOIN operator, we'll check if there any other way to do it.
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
I tested with VServer 7.1.6 – is it a problem with that version?
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Hello Sergey

Have to reactivate this thread...
Trying to use Merge but it does not work as I am expecting. :(

The sample from Wiki does not work – using dot-notation for fields is throwing errors!?
Found a sample from Ruslan that works but it is too simple.


this works without throwing an error:

MERGE main as mtarget
USING imp as isource ON (isource.artikelnummer = mtarget.artikelnummer)
WHEN MATCHED THEN
UPDATE SET name = isource.name


this is throwing an error:

MERGE main as mtarget
USING imp as isource ON (isource.artikelnummer = mtarget.artikelnummer AND isource.barcode = mtarget.barcode)
WHEN MATCHED THEN
UPDATE SET name = isource.name


this works without throwing an error:

MERGE main as mtarget
USING imp as isource ON (isource.artikelnummer = mtarget.artikelnummer AND isource.barcode <> mtarget.barcode)
WHEN MATCHED THEN
UPDATE SET name = isource.name



**********************************************************

I want to do anything like this:

MERGE main as mtarget
USING imp as isource ON (isource.artikelnummer = mtarget.artikelnummer AND isource.barcode = mtarget.barcode)
WHEN NOT MATCHED BY TARGET THEN
INSERT(artikelnummer, barcode, name) VALUES(isource.artikelnummer, isource.barcode, isource.name)
WHEN MATCHED THEN
UPDATE SET mtarget.name = isource.name


and a second one to delete:

MERGE main as mtarget
USING imp as isource
ON (isource.artikelnummer = mtarget.artikelnummer and isource.barcode = mtarget.barcode AND remove = 1)
WHEN MATCHED THEN
DELETE




What did I misunderstand?
How to make it work?


Best regards.
Chris
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Hi Sergey

Thank you for the clear answer.
I will take a look at that.


Best regards.

Chris.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hi Christian,

No, it is impossible to do directly.

One of the possible ways:
1. Create intermediate (temporary or even RAM) table
2. Import records to this table
3. Use MERGE command to update existing and insert new records in the target table
Referenzen
  1. http://valentina-db.com/docs/dokuwiki/v9/doku.php?id=valentina:vcomponents:vsql:reference:merge
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Hi Sergey

Actually not really but they are products and have a barcode-number.
Is it possible directly while importing from text?
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello Christian,

For example, if the imported text contains the RecID or primary key column, right?
Kommentar
There are no comments made yet.
Christian Breu Akzeptierte Antwort
Is it possible or not?
Kommentar
There are no comments made yet.
  • Seite :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories