sql server - SSMS - How to Move or copy a column from one table to another table in sql -


i have 2 tables; dbo.company , dbo.jobs

i move column dbo.company dbo.jobs.

the column called company_name, add on end of dbo.jobs table.

i can create query table of 2 tables linked there primary keys, company_id , jobs_id.

try t-sql:

alter table dbo.jobs add company_name varchar(500) -- change actual data-type go  update dbo.jobs set company_name = c.company_name dbo.jobs j inner join dbo.company c on j.company_id = c.company_id -- change actual foreign key 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -