November 2, 2001 at 11:41 am
I am fairly new to SQL Server. I am trying to write a stored procedure to update fields in a table with information in another table. Both tables have a common key field. I have not been able to get this to work. Any help would be graetly appreciated.
Percival Bragg
Percival Bragg
November 2, 2001 at 3:59 pm
Hi Percival,
If you post what you have, we'll try to help. What you're trying to do is pretty straight forward I think, something like this:
Create proc usp_DoSomething as
--Sample proc to update a table
set nocount on
update a set a.somefield=b.somefield from table1 as A inner join table2 as B on A.primarykey=b.primarykey where b.someotherfield='whocares'
Andy
November 3, 2001 at 9:42 pm
My suggestion is to try to accomplish your goal in query analyzer first. Once you have the sql working copy it into a stored procedure.
November 5, 2001 at 12:46 pm
Post your code and we can help, but Leon is right. Get it working in QA first.
Steve Jones
November 6, 2001 at 6:34 am
Thanks everyone for your help. I was able to accomplish what I wanted using your suggestions. Your help was well appreciated.
Percival Bragg
Percival Bragg
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy