Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful when updating a large quantities of rows from a big table
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