How can copy 1 database table data to another database table
how can copy one database table data to another database table in porgramaticaly plz send idea or example
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ravi KumarRank #2,085 · 690 reputationPosted Apr 9, 2015, 12:07 AM EDT
use the store procedure
example given below
create procedure procedurename
as
begin
insert into secondtablename(columns1,column2)(select column1,column2 from firsttablename)
end
Najim MullaRank #2,088 · 689 reputationPosted Apr 9, 2015, 12:13 AM EDT
Ravi KumarRank #2,085 · 690 reputationPosted Apr 9, 2015, 12:14 AM EDT
both are in same database or different database.
server same or different
Najim MullaRank #2,088 · 689 reputationPosted Apr 9, 2015, 12:15 AM EDT
Ravi KumarRank #2,085 · 690 reputationPosted Apr 9, 2015, 12:16 AM EDT
server also different or what
Najim MullaRank #2,088 · 689 reputationPosted Apr 9, 2015, 12:18 AM EDT
Ravi KumarRank #2,085 · 690 reputationPosted Apr 9, 2015, 12:19 AM EDT
example given below
create procedure procedurename
as
begin
insert into databasename2.dbo.secondtablename(columns1,column2)(select column1,column2 from databasename1.dbo.firsttablename)
end
Najim MullaRank #2,088 · 689 reputationPosted Apr 9, 2015, 12:24 AM EDT
Ravi KumarRank #2,085 · 690 reputationPosted Apr 9, 2015, 12:27 AM EDT
Najim MullaRank #2,088 · 689 reputationPosted Apr 9, 2015, 12:35 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 9, 2015, 12:56 AM EDT
Right-Click on table -> Script Table As -> Create To -> New Window
--
In the window, change database name/
Database - 1st Line
USE [DatabaseName]