Information générale
Catégorie:
Bases de données
Versions des environnements
Network:
Windows 2003 Server
>I have a dataset that is constructed from various sources. So, the number of fields in them varies from one places to another. However, it is all for the same table. The goal is to find the missing fields and add them into the dataset.
>
>The first part is to detect the missing field. This is no problem. I have a collection of all the required fields. I compare with what I have in the dataset. If it is not in there, I add them up in a variable such as "Table.FirstName,Table.LastName,etc.". Some sources may have 1 record, others 136 and so on. So, I need to execute a SQL command which will go get the missing field values from the table so the result would be the final version of the dataset.
>
>Once step I have to go through is to get all the primary keys. So, lets say I have them up in a collection, in a list such as "12, 1024, 3244, 1211" or else. I then need to execute a SQL command to get the missing fields based on those primary keys. I am pretty sure there is a better way to achieve that then to construct a SQL command with a bunch of WHERE clauses with an OR statement for each of the primary key. Anyone would have an idea on a better route to take?
not sure if I have a correct mental picture, but assuming you have a already consolidated table you currently plan to get the missing data from, might it not be easier to get a copy from there of all records with pk in [PkFoundInDataset] itno a temp table and only update this temp table with existing/found values from the dataset ?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement