Created
April 4, 2017 14:38
-
-
Save Tgo1014/c84a070a609eea58d0b00df3fc4d016b to your computer and use it in GitHub Desktop.
Useful when updating a large quantities of rows from a big table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WHILE 1 = 1 | |
BEGIN | |
UPDATE TOP(100000) A | |
SET CIA = CASE | |
WHEN DS_INDICADOR = 'AUTO' THEN LEFT(RIGHT(CD_ITEM,14),3) | |
WHEN DS_INDICADOR IN ('RE','RAMOS ELEMENTARES') THEN LEFT(RIGHT(CD_ITEM,10),3) | |
ELSE 0 | |
END | |
FROM DB_PGC_PRODUCAO..TB_DM_INFO_GER_ANALITICO_HIST A | |
WHERE CIA IS NULL | |
IF @@ROWCOUNT < 1 BREAK; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment