Re: update table according to reference table?
From: DWinter (dwinter_at_attbi.com)
Date: 10/03/04
- Next message: DWinter: "Re: In a single query"
- Previous message: Greg Linwood: "Re: server-side profiling"
- In reply to: ttidy: "update table according to reference table?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 2 Oct 2004 23:22:43 -0400
Is the Code, the primary key? Is there an index on the Code? Any triggers
that fire on update?
If Code is the primary key to the table, you may want to remove it and
reapply the constraint after you make the update. You may want to do the
same with any index that is using the Code field, and any trigger that
fires. This is just so you don't do any extra work. But here is your query.
UPDATE OriginalTable SET code=ReferenceTable.new_code FROM ReferenceTable
WHERE ReferenceTable.Current_code=OriginalTable.code
"ttidy" <ttidy@discussions.microsoft.com> wrote in message
news:3D224F65-A116-4AA3-8087-E62E635BE1F9@microsoft.com...
> Hi,
>
> I need to program a update statement to update 4.3 millions records in a
> table, which changes were according to a reference table. What is the
fastest
> way to do this update statment. Thanks so much advance!
>
> Reference table example:
> Current_code new_code
> 1 3
> 2 5
> 3 4
> .. ..
> 999 1220
>
> Needs to update table:
> code address zip
> 1 1st st... 75000
> 2 .. 75001
> 3
> ..
> 999 .. 75009
>
>
>
>
- Next message: DWinter: "Re: In a single query"
- Previous message: Greg Linwood: "Re: server-side profiling"
- In reply to: ttidy: "update table according to reference table?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|