1. Christian Breu
  2. as Valentina DB Server
  3. Среда, Март 27 2019, 11:08 PM
  4.  Подписаться через email
[How] is it possible to just update existing records while using vCursor.importText()?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
I added a feature request for JOIN operation which is used in MERGE command.
Ссылки
  1. http://valentina-db.com/bt/view.php?id=8513
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Hello Ruslan

Thank you for the info.
What does it mean v9.2 – before/until may 20?
This should be ok.
Комментарий
There are no comments made yet.
Ivan Smahin Ответ принят
Please check v.9.2 (coming soon) - all kind of merges are supported now.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Christian,

A new version is available for download.
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Is it possible or not?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Christian,

For example, if the imported text contains the RecID or primary key column, right?
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Hi Sergey

Actually not really but they are products and have a barcode-number.
Is it possible directly while importing from text?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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
Ссылки
  1. http://valentina-db.com/docs/dokuwiki/v9/doku.php?id=valentina:vcomponents:vsql:reference:merge
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Hi Sergey

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


Best regards.

Chris.
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
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
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
I tested with VServer 7.1.6 – is it a problem with that version?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
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
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Do I have to set it as a feature request somewhere?
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Thank you Sergey!
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
Hoping for some progress about this topic.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
9.1.5 archive can be found here already:

http://valentina-db.com/download/prev_releases/9.1.5
Комментарий
There are no comments made yet.
François Van Lerberghe Ответ принят
Hi Christian,

Try with this link code :

ON (isource.artikelnummer = mtarget.artikelnummer AND isource.barcode = CONCAT(mtarget.barcode))
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
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
Комментарий
There are no comments made yet.
Christian Breu Ответ принят
is it implemented already?
Комментарий
There are no comments made yet.
  • Страница :
  • 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