query issues

I have a table with 12 columns tblA and another with 2 columns tblB. Both table have a common column which is something like the primary key. I need to transfer one column from the tblB to tblA.

more ▼

asked Apr 23, 2015 at 01:13 PM in Default

avatar image

20 7

What does it mean 'transfer'? You want UPDATE one column in tblA with values from column in tblB or something else? What is relationship between these two tables? Could you provide us tsql code for your two tables?

Apr 23, 2015 at 01:33 PM Sule
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

sounds like you can use the "something like the primary key" column as a mechanism for doing JOIN between the two tables. If I understand this, you want to modify the data in one table based on the data in the other. You can do this using UPDATE ... FROM There are code samples there. You can use your common table as the comparison criteria.

more ▼

answered Apr 23, 2015 at 04:14 PM

avatar image

Grant Fritchey ♦♦
137k 20 46 81

update statement worked

Apr 23, 2015 at 05:33 PM Wiz

Good to know. Thanks for reporting back.

Apr 23, 2015 at 05:58 PM Grant Fritchey ♦♦
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Apr 23, 2015 at 01:13 PM

Seen: 28 times

Last Updated: Apr 23, 2015 at 05:58 PM

Copyright 2018 Redgate Software. Privacy Policy