February 2, 2010 at 2:05 pm
I have this code that i have been able to come up with to pull a specific list of data. I now want to do an insert and update on a different table (00100). How can i get this done? I want to update(insert if the record does not exist into) the 00100 table with the ACCOUNTNUMBER, CTCENTER, LEAD, and ACCOUNTDESCR information from the query.
Can anyone please help me out here? I know this should be easy, but am stuck with the insert/update.
Thanks
select ac1.actnum AS ACCOUNTNUMBER, ac2.sgtid AS CTCENTER, ac3.sgtid AS LEAD, ac1.actnm AS ACCOUNTDESCR
from (select * from temp_leadtable ) as ac1,
(select * from 00200 where sgtnumb =2) as ac2,
(select * from 00200 where sgtnumb =3) as ac3
February 3, 2010 at 12:14 am
Try using Merge statement
February 3, 2010 at 7:24 am
Here's the BOL link for MERGE
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply