Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a question, i want to add only new data from xls file to existing qvd file. For Example:
My QVD File has this data:
NTNAME POSITION AREA
ABC A AREA1
DEF B AREA2
GHI C AREA3
AND i have one xls file has this data:
NTNAME POSITION AREA
ABC A AREA2
D B AREA2
G C AREA3
DEF B AREA2
I want to have this result:
NTNAME POSITION AREA
ABC A AREA1 ("ABC" FROM XLS FILE NOT ADDED to QVD, because "ABC" already exist in qvd file although "ABC" in XLS file has different AREA with ABC in QVD)
DEF B AREA2
GHI C AREA3
D B AREA2 (D is added because no NTNAME "D" in QVD FILE)
G C AREA3 (G is added because no NTNAME "G" in QVD FILE)
I cant use distinct because if I use distinct, ABC in XLS FILE will be added to qvd file because differ AREA.
Really need your helps, Thanks
Regards,
Indra
Add a primary-key column to your QVD. A primary key is a unique identifier of a specific record. In DBMS, a primary key value can not appear twice in the same table.
The content of this primary key can be a concatenation of NTNAME and AREA if you want unique combinations of these value,s or just plainly NTNAME as per your description.
Then only load from your XLS with a clause like
CONCATENATE (DataFromQVD)
LOAD
:
FROM Excel
WHERE NOT Exists(PrimaryKey, concatenation of fields in primary key);
or following your description:
CONCATENATE (DataFromQVD)
LOAD
:
FROM Excel
WHERE NOT Exists(NTNAME);
Best,
Peter
Add a primary-key column to your QVD. A primary key is a unique identifier of a specific record. In DBMS, a primary key value can not appear twice in the same table.
The content of this primary key can be a concatenation of NTNAME and AREA if you want unique combinations of these value,s or just plainly NTNAME as per your description.
Then only load from your XLS with a clause like
CONCATENATE (DataFromQVD)
LOAD
:
FROM Excel
WHERE NOT Exists(PrimaryKey, concatenation of fields in primary key);
or following your description:
CONCATENATE (DataFromQVD)
LOAD
:
FROM Excel
WHERE NOT Exists(NTNAME);
Best,
Peter
Hi Peter,
Wow, thanks for your help, it solved my problem.
Really appreciate your help.
Thanks.
Regards,
Indra