[dba-SQLServer] [AccessD] I found this

David McAfee davidmcafee at gmail.com
Fri Sep 17 13:51:22 CDT 2010


Have you tried it this way?

UPDATE TABLEA
SET
A.FIELD1 = B.FIELD1,
A.FIELD2 = B.FIELD2,
A.FIELD3 = B.FIELD3,
A.FIELD4 = B.FIELD4,
A.FIELD5 = B.FIELD5,
A.FIELD6 = B.FIELD6,
A.FIELD7 = B.FIELD7,
A.FIELD8 = B.FIELD8,
A.FIELD9 = B.FIELD9,
A.FIELD10 = B.FIELD10,
A.FIELD11 = B.FIELD11,
A.FIELD12 = B.FIELD12,
A.FIELD13 = B.FIELD13,
A.FIELD14 = B.FIELD14,
A.FIELD15 = B.FIELD15,
A.FIELD16 = B.FIELD16,
FROM TABLEA AS A
INNER JOIN TABLEB AS B
ON A.ID = B.ID


On Fri, Sep 17, 2010 at 11:28 AM, jwcolby <jwcolby at colbyconsulting.com> wrote:
> UPDATE TABLEA SET
> FIELD1 = (SELECT TABLEB.FIELD1 FROM TABLEB WHERE TABLEB.ID = TABLEA.ID),
> FIELD2= (SELECT TABLEB.FIELD2 FROM TABLEB WHERE TABLEB.ID = TABLEA.ID)
>
> It seems darned ugly but I can see the logic.  However I have about 16 fields to update for (in some
> cases) a subset of 2 million records in a 65 million record table.
>
> It seems like this is going to be very inefficient.
>
> --
> John W. Colby
> www.ColbyConsulting.com
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the dba-SQLServer mailing list