Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error on Insert

Status
Not open for further replies.

mts176

MIS
Apr 17, 2001
109
US
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
 
Hi,

Could you be a bit more specific with your question than 'What am I doing
wrong.'

Are you getting an error message when you run the code, or does it give you the wrong results??

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top