SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to copy data from one table to another
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Abid
Posting Yak Master

Pakistan
109 Posts

Posted - 03/09/2014 :  22:05:11  Show Profile  Reply with Quote
Hi. I have a table ProductBasicInfo, which has following fields:

ProdID (PK)
ProdName
Description
Manufacturer
Store
ProdPrice


Now i have another table TempPrice, having fields:


TempID (PK)
ProdID  (FK)
TempProdPrice


TempPrice table has the original values, which are needed to copy into ProductBasicInfo column "ProdPrice" (which is entire NULL column so far). Please assist me that how to do this. Thanks in advance.

khtan
In (Som, Ni, Yak)

Singapore
17658 Posts

Posted - 03/09/2014 :  23:36:14  Show Profile  Reply with Quote

UPDATE  p
SET     ProdPrice = t.TempProdPrice
FROM    ProductBasicInfo p
INNER JOIN TempPrice t ON p.ProdID = t.ProdID



KH
Time is always against us

Go to Top of Page

Abid
Posting Yak Master

Pakistan
109 Posts

Posted - 03/10/2014 :  06:02:05  Show Profile  Reply with Quote
Thanks khtan, would you please tell me that what is P and what is t???
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17658 Posts

Posted - 03/10/2014 :  06:26:52  Show Profile  Reply with Quote
table alias


KH
Time is always against us

Go to Top of Page

Abid
Posting Yak Master

Pakistan
109 Posts

Posted - 03/10/2014 :  07:11:17  Show Profile  Reply with Quote
quote:
Originally posted by khtan

table alias



Sorry, but what is table alias?
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17658 Posts

Posted - 03/10/2014 :  07:18:10  Show Profile  Reply with Quote
alias is another name assigned to the table

http://www.w3schools.com/sql/sql_alias.asp


KH
Time is always against us


Edited by - khtan on 03/10/2014 07:18:39
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000