Kumar Ravishankar

Kumar Ravishankar

  • NA
  • 437
  • 7.9k

Have to select data from table and insert in to same table

Apr 26 2018 7:06 AM
INSERT INTO tbl_NonQuestionField (FormId,NoneQuesColumnName,NoneQuesColumnDisplayName)
(
SELECT FormId, NoneQuesColumnName, NoneQuesColumnDisplayName FROM tbl_NonQuestionField
WHERE Id <=16
Id F_d A B
1 609 Points Points
2 609 Band Band
I have to select Column A AND B, and then have to insert in same table but F_D Column value will be different ..
I have tired 
CREATE PROCEDURE dbo.InsertIntbl
@F_d INT
AS
BEGIN
INSERT INTO tbl_NonQuestionField (F_d,A,B)
(
SELECT A, VFROM tbl_NonQuestionField
WHERE Id <=2
)
)

Answers (2)