468,242 Members | 1,455 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

Update Query..

Hello every one:

I am missing a basic concept here. Any help will be appreciated.

I have two tables with lot of fields in both, but two common fields. Even they are not the primary keys but ID is unique and distinct in both so it is safe to join table with ID field.

Let say table A has A.ID and A.DATE fields.
Table B has B.ID and B.DATE fields.

I need to update the entire A.DATE field same as B.DATE for corresponding IDs.

What would be the best solution (APPEND / INSERT / UPDATE) and why? Since I am stuck with basic here, any syntax would be helpful.

Thanks.

Habib.
Sep 19 '08 #1
2 1050
ck9663
2,878 Expert 2GB
You already said it, you need to UPDATE one field with the other. So you don't have a choice but UPDATE. At least the most if you're looking for the most efficient way. Coz you can always go through creating a new table through a SELECT INTO then dropping the current one and renaming the temp table. Too complicated.

If you don't need to UPDATE the table and instead, you need to create a new TABLE with the updated fields, a SELECT INTO is your choice, but if you have triggers and constraint, it will not kick-in. If you want to enforce triggers and constraints, create the new table and do an INSERT.

There's no APPEND in SQL SERVER. Only INSERT.

-- CK
Sep 19 '08 #2
Thanks for the explanation, a simple but very brief. That's what I needed.

Habib.
Sep 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Mike Leahy | last post: by
10 posts views Thread by Randy Harris | last post: by
7 posts views Thread by Mark Carlyle via AccessMonster.com | last post: by
31 posts views Thread by Lag | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.