Wednesday 21 June 2017

Insert multiple tables data into another table in SQL Server.

Insert multiple tables data into another table in SQL Server.
Description:
In this example we explain that how to Insert multiple Tables data into another table in SQL Server. Or how to insert multiple tables data into single table in SQL Server. Or SQL Query to insert multiple tables data into another (single) table.

Suppose we have two table like “State” and “Country” and we want to insert those both tables data into another table called “CountryState”.so below is the SQL Query to insert multiple tables data into single table.
Query:

Insert into CountryState(Country,Statename)
SELECT     dbo.State.StateName, dbo.Country.CountryName
FROM         dbo.Country INNER JOIN
                      dbo.State ON dbo.Country.Id = dbo.State.CountryId_Fk


This entry was posted in :

0 comments:

Post a Comment