Avatar of Favorable
Favorable
Flag for United States of America asked on

Stored Procedure Help in SQL

I need help with a stored procedure that handle insert/update in a SQL table. SQL table on server A and converted data on server B (linked Server).

I have provided columns from both tables and attached a screen shot.



-- Stored procedure to insert/update a table from a linked server.

------- Table One columns in server A

Insert  tablename
            ID
            FormID,
            StateProvinceCode,
            StatusCodeID,
            EffectiveDate,
            ExpirationDate,
            ApprovedBy,
            ApprovalDateTime


---Table two columns coming from a linked server B

Select
      cc
      state
      efdt
      expdt
      crby
      crdt
      mtby
      mtdt
      exc
      cnrownumber
      cnxSyncDate ---  (optional column)
 
-----  Note
cc column should be inserted/update ---->  StatusCodeID
state column should be inserted/update  --->  StateProvinceCode
cnrownumber column should be  inserted/update  ---->  ID

FormID numbers to stay the same.
Screen-shot-of-the-result-sets-f.docx
Microsoft SQL Server

Avatar of undefined
Last Comment
Favorable

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
chaau

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Favorable

ASKER
Formid is a default number already assign, so we will ignore that column.
Favorable

ASKER
Thank you so much
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes