Friday, February 5, 2016

Insert/ Update a table with data from another table


Insert

[code] insert into Distributors(CompanyName,City,District,TelephoneNo, DistributorListId,TypeListId) select CompanyName,City,'Colombo',Phone,88,2 from Temp [/code]


Update

[code] update Distributors set Distributors.District = Temp.District from Distributors inner join Temp on Distributors.ListId = Temp.ListId [/code]

No comments:

Post a Comment