Solution
INSERT INTO destination_table (column names ) (select column names from the source_table );
e.g.
INSERT INTO [dbo].[t_Menu]
(Name,ParentId)VALUES
('CustomizedReports',(select id from t_Menu where Name='Reports'))
go
Explanation
Here I have inserted the value in the same table, you can write name of the other table in select statement if you want to get from other table. In the example, above ParentId is the ID of Reports and is being inserted into ParentId of Customized Reports
Leave a comment