Avatar of Larry Brister
Larry Brister
Flag for United States of America asked on

Clone MS SQL Server Data across multiple sub tables

I have a set of data that I need to clone from three cascading tables
tblSurvey has SurveyID, SurveyName   (UID is SurveyID)
tblQuestions has QuestionID, QuestionText, SurveyID   (UID is QuestionID)
tblAnswers has  AnswerID, AnswerText,QuestionID  (UID is AnswerID)

I insert into tblSurvey (Select SurveyName from tblSurvey where SurveyID = @OldSurveyID)
I insert into tblQuestions (Select QuestionText,@NewSurveyID from tblQuestions where SurveyID = @OldSurveyID)

My problem is matching inserting the AnswerText and matching to the new set of QuestionID's
Microsoft SQL Server 2008Microsoft SQL ServerRemote Access

Avatar of undefined
Last Comment
Larry Brister

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
lcohan

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.
Larry Brister

ASKER
I'll review when I am back at my desk in the morning
Larry Brister

ASKER
Very sorry for the late getback

I have been traveling
Your help has saved me hundreds of hours of internet surfing.
fblack61