Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating first occurance of a match in SP
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Updating first occurance of a match in SP
Divers
Thread ID:
00799304
Message ID:
00799304
Vues:
58
Hi,

Im my appp, there is a stored proc that loops through one table and finds a matching entry in another table and updates both tables 'RecordMatchID' field with the same integer value.

With this data, 99.9% of the time there is a one-to-one match - however, occasionally, the source table will have one record that "matches" to two records in the second table.

Currently when I update the second table, I use something like this:

Update SecondTable
set SecondTable.RecordMatchID = @MatchIN
where SecondTable.MatchCriteriaVC = @MatchVC

What I'd like to do in the .01% of the cases where there are more than one matching record - is to just update 'SecondTable' for the first occurance where the matching criteria is met ...

Any suggestions on how to best approach this?
Al Williams

Anola MB, CANADA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform