So without wasting time let’s have a look at the query to insert records from one DB table to another DB table on a same server.
Insert into [Database Name].[Schema].[Table Name]
Select * from [Database Name].[Schema].[Table Name]
If you want to pick specific columns then you will write this query like this
Insert into [Database Name].[Schema].[Table Name](Column1,Column2)
Select Column1, Column2 from [Database Name].[Schema].[Table Name]
For example you are moving customer table’s data from Northwind database to AdventureWorks database on the same server/machine/computer then your query will be
Insert into [AdventureWorks].[dbo].[Customer]
Select * from [Northwind].[dbo].[Customer]
Comments and Suggestions are Always Welcome!
No comments:
Post a Comment