Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored procedure INSERT INTO

Author  Topic 

programer
Posting Yak Master

221 Posts

Posted - 2011-04-26 : 16:31:31
Hi,

I have tbl_table1:
ID, Description, Amount


and tbl_table2:
ID, Description_table1, Amount_table1


When I stored data in table1 "Description" and "Amount" is stored in the table2 data that I store in table1

Like this:
In table1 I stored description5, Amount 10

Data from table1 automatically saves the data in table2


edit: moved to proper forum

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-26 : 16:49:32
So what is your question?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

programer
Posting Yak Master

221 Posts

Posted - 2011-04-26 : 17:22:53
quote:
Originally posted by tkizer

So what is your question?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



My question is:
How do I save "Amount" from table1 in table2 with Stored procedure?
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-04-26 : 18:33:13
You would have to UPDATE table2

UPDATE t2
SET Amount_table1 = t1.Amount
FROM tbl_Table2 t2
INNER JOIN tbl_Table1 t1
ON t2.ID = t1.ID

Jim


Everyday I learn something that somebody else already knew
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-04-26 : 19:09:30
Is it a full moon today?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-04-26 : 19:18:54
It has to be the start of a new semester somewhere.
Jim

P.S. I got your full moon right here, buddy!

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -