I have two table as given below. Questions
Questionid Question
1 Question1
2 Question2
3 Question3
4 Question5
5 Question8
6 Question4
Answers
AnsID AnsText Questionid
1 Ans1 1
2 Ans 2 1
3 Ans 3 1
4 Ans 4 1
5 Ans 8 2
6 Ans 5 2
7 Ans 6 2
8 Ans 7 2
9 Ans 9 3
10 Ans 15 3
11 Ans 14 3
12 Ans 13 3
13 Ans 12 4
14 Ans 11 4
Now want to Insert multiple question with multiple answers in sql server using User-Defined Table Types.
I have create a type for question table.
CREATE TYPE [dbo].[Questions] AS TABLE(
[Questionid] [int] NULL,
[Question] [nvarchar](max) NULL
)
And insert multiple question separately. But I want to insert multiple questions with multiple answer using User-Defined Table Types.
would you help me.