Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Way To Do This
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01520112
Message ID:
01520171
Vues:
52
Here's what I used, and it worked fine.


USE Indiana_ODS_VT
/*
SELECT TOP 100 * FROM FarmersImport
SELECT TOP 100 * FROM tblCamp_CT_Kevin
*/


UPDATE tblCamp_CT_Kevin SET Farmer = NULL
SELECT @@ROWCOUNT
-- Returns 696397

BEGIN

BEGIN TRANSACTION

UPDATE tblCamp_CT_Kevin SET Farmer = '1'
FROM tblCamp_CT_Kevin c
INNER JOIN FarmersImport fi ON LTRIM(RTRIM(fi.[FirstName])) = LTRIM(RTRIM(c.FName)) AND
LTRIM(RTRIM(fi.[LastName])) = LTRIM(RTRIM(c.LName)) AND
LTRIM(RTRIM(fi.[RegCity])) = LTRIM(RTRIM(c.City))
WHERE c.Farmer IS NULL

SELECT @@ROWCOUNT

--39604 with MailCity
--39701 with RegCity

IF @@ROWCOUNT = 0
BEGIN
COMMIT TRANSACTION
END
ELSE
BEGIN
ROLLBACK
END

END


Thanks everyone
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform