Re: Script to copy table between databases

From: Rohtash Kapoor (rohtash_nospam_at_sqlmantra.com)
Date: 02/19/04


Date: Wed, 18 Feb 2004 20:52:10 -0800


--This will copy all the data from MyTable in Database2
DELETE FROM Database2.dbo.MyTable

--This will insert all the records from Mytable from Database2 to MyTable
table of Database1
INSERT Database2.dbo.Mytable
  SELECT * FROM Database1.dbo.Mytable

---
Rohtash Kapoor
http://www.sqlmantra.com
"newbie" <anonymous@discussions.microsoft.com> wrote in message
news:D713E800-A623-4BD4-8AE1-29E262E0179F@microsoft.com...
> I'm trying to write/find a script that will copy all data from a table in
database1 to the same table in database2.  The databases are on the same
server and the destination table already exists and is identical in design.
I need to overwrite the destination table data if it already exists.
>
> Thanks