Click here to Skip to main content
16,015,635 members

Comments by Member 10397661 (Top 1 by date)

Member 10397661 12-Nov-13 21:59pm View    
below are the scripts.please check this and any solution

CREATE TABLE [dbo].[surveyanswers](
[id] [int] IDENTITY(1,1) NOT NULL,
[questionid] [nvarchar](50) NULL,
[response] [nvarchar](50) NULL,
[points] [nvarchar](50) NULL,
CONSTRAINT [PK_surveyanswers] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


output

id questionid response points

1 1 yes 4
2 1 yes 5
3 1 no 3
4 2 no 12
5 2 yes 2
6 3 copper 14




Here questionid is ques_1 and q1build for this i want to insert response='yes' goes to ques_1 column and points =4 value goes to q1build

CREATE TABLE [dbo].[surveryanswers1](
[id] [int] IDENTITY(1,1) NOT NULL,
[ques_1] [nvarchar](50) NULL,
[q1build] [nvarchar](50) NULL,
[ques_2a] [nvarchar](50) NULL,
[q2abuild] [nvarchar](50) NULL,
[ques_2b] [nvarchar](50) NULL,
[q2bbuild] [nvarchar](50) NULL,
[ques_2c] [nvarchar](50) NULL,
[q2cbuild] [nvarchar](50) NULL,
[ques_3] [nvarchar](50) NULL,
[q3build] [nvarchar](50) NULL,
[ques_4] [nvarchar](50) NULL,
[qbuild] [nvarchar](50) NULL,
[ques_5] [nvarchar](50) NULL,
[qbuild5] [nvarchar](50) NULL,
CONSTRAINT [PK_surveryanswers1] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


output

id ques_1 q1build ques_2 q2build

1 yes 4 no 12