I am copying data from two duplicate tables. I want some of the information from the one table but I also want to put in some of my own information in. This is the code I am using. What am I doing wrong.
declare @x INT
select @x = 85
WHILE @x <= 100
begin
SELECT @x = @x + 1
INSERT INTO [dbo].[tblMenu](Menu_ID, Menu_Tree, Menu_Level,Menu_Order,Parent_ID,Display_Text,Display_Text_Short ,Function_ID,Function_Parameters,Rights_ID,Hide_Flag,Available
The variable and numbers are the changes that I want to insert The select is what I want from the table
After tblMenu is completed tblMenuX is just going to be a back up of the way it was before the change so I don't want to change that table.
Values (@x,1,1,1,6, (SELECT DISTINCT Display_Text, Display_Text_Short, Function_ID, Function_Parameters,Rights_ID, Hide_Flag, Available FROM [dbo].[tblMenuX]
WHERE Parent_ID = 54)
END
go
declare @x INT
select @x = 85
WHILE @x <= 100
begin
SELECT @x = @x + 1
INSERT INTO [dbo].[tblMenu](Menu_ID, Menu_Tree, Menu_Level,Menu_Order,Parent_ID,Display_Text,Display_Text_Short ,Function_ID,Function_Parameters,Rights_ID,Hide_Flag,Available
The variable and numbers are the changes that I want to insert The select is what I want from the table
After tblMenu is completed tblMenuX is just going to be a back up of the way it was before the change so I don't want to change that table.
Values (@x,1,1,1,6, (SELECT DISTINCT Display_Text, Display_Text_Short, Function_ID, Function_Parameters,Rights_ID, Hide_Flag, Available FROM [dbo].[tblMenuX]
WHERE Parent_ID = 54)
END
go