ADODB: duplicates -problem

A

Adax

Hello, I have problem with auto-separating duplicates records by PrimaryKey
i Access table.
Dim conn As ADODB.Connection
conn.Execute "INSERT INTO Tabele1.....", p1, p2
Is it possible set the p1 & p2 parameters for this?

I want to have similary solution, that in DoCmd.RunSQL, where is
auto-separating duplicates records:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Tabele1.....", -1
DoCmd.SetWarnings True

Help me, please, Thanks!
 
A

Adax

Uzytkownik "dan dungan said:
Hi Adax
Are you coding in Excel or Access?
Dan

I have advanced calculation in VBA in Excel and from Excel I have resalt:
matrix: 100 000 x 20. Unfortunately some from 100 000 records are duplicate
(each field, without Index certanly) and I'm looking for quick solution,
that help me separate theese duplicates. Could You help me find the good
solution for this problem? Thanks!
 
P

Patrick Molloy

I'm a little confused. You started with an INSERY statement m, but now you
want to read data?

your insert should be something like

INSERT INTO table ([field1],[field2]) values ( 'a','b')

i guess 'a' and 'b' are the params

so
sSQL= "INSERT INTO table ([field1],[field2]) values ( '%a%','%b%')"
sSQL = REPLACE(sSQL,"%a%", p1)
sSQL = REPLACE(sSQL,"%b%", p2)


your 2nd question is reading data but avoiding dulicates.
Have you tried using DISTINCT
SELECT DISTINCT [field] FROM
 
A

Adax

Użytkownik "Patrick Molloy" <[email protected]>
napisał w wiadomości
I'm a little confused. You started with an INSERY statement m, but now
you want to read data?

Unfortunately, I can't change the way of storage data in matrix 100 000 x 20
and now I'm only looking for the way duplicates separate.

Dim conn As ADODB.Connection
conn.Execute "INSERT INTO Tabele1.....", p1, p2

p1, p2 are connection parameters!

This DoCmd.RunSQL "INSERT INTO (in Access) is the best and terfore I'm
looking similary way in ADODB.Connection
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO Tabele1.....", -1
DoCmd.SetWarnings True
your insert should be something like
INSERT INTO table ([field1],[field2]) values ( 'a','b')
i guess 'a' and 'b' are the params
so
sSQL= "INSERT INTO table ([field1],[field2]) values ( '%a%','%b%')"
sSQL = REPLACE(sSQL,"%a%", p1)
sSQL = REPLACE(sSQL,"%b%", p2)
your 2nd question is reading data but avoiding dulicates.
Have you tried using DISTINCT
SELECT DISTINCT [field] FROM


Yes, I have tried. Unfortunately one of field is different (key) and for
this reason I can't make simple SELECT DISTINCT.... Probably I have to
make subselect, but the most importest is short time, because I have about
100 000 records...
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top