Re: Script to copy table between databases
From: Rohtash Kapoor (rohtash_nospam_at_sqlmantra.com)
Date: 02/19/04
- Next message: Ray Higdon: "Re: How do I separate in SQL"
- Previous message: Rohtash Kapoor: "Re: Split Field or Extract a part"
- In reply to: newbie: "Script to copy table between databases"
- Next in thread: Vishal Parkar: "Re: Script to copy table between databases"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Ray Higdon: "Re: How do I separate in SQL"
- Previous message: Rohtash Kapoor: "Re: Split Field or Extract a part"
- In reply to: newbie: "Script to copy table between databases"
- Next in thread: Vishal Parkar: "Re: Script to copy table between databases"
- Messages sorted by: [ date ] [ thread ]