Copy Table from another table
How to create a Table from another Table?I need both structure and data ?If any one know pls rply byemuralimurali@gsdindia.com
May 16th, 2005 3:38am
Hi,If your using SQLServer 2000 then you could use the DTS(Data Transformation Services). you could select your source database. And select the same database for its destination. When importing a copy of your table, you must rename it...cheers,Paul June A. Domag
Free Windows Admin Tool Kit Click here and download it now
May 16th, 2005 2:12pm
It's not clear whether you need Integration Services in this scenario. A 'SELECT... INTO' SQL statement might be sufficient. For more information, check books online.regards,ash
May 17th, 2005 1:49pm
If you're using Integration Service, you can use the transfer objects task. It will create the table and transfer the data it contains.
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2005 2:59pm
The simplest method of all for doing this is to simply use the SELECT INTO statment. Here's how:Suppose you're trying to copy the authors table of the Pubs SQL Server database with data and structure. To do so simply use this SQL script:-----------------------USE PubsGOSELECT *INTO copy_of_authorsFROM authorsGO-----------------------Executing this script will create a table named copy_of_authors containing all data from the authors table.Regards,Ejan
May 21st, 2005 6:57am
Hi,If u want to copy a table from another table with creating a same table u can use
SELECT
* INTO Table1backup FROM Table1 this will create a Table1backup having same columns and data as in table with name Table1.and
Insert
into Table1backup select * from Table1 this will insert all the data of table1 into table1backup but for this table1backup should exist with same columns as table1.I hope this would be helpful for u.regards,Arvind
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2009 9:52am
Newtable Oldtable
select * into table1 from acc_taxtype
April 14th, 2010 3:29am
works, great & thanx
Free Windows Admin Tool Kit Click here and download it now
March 15th, 2012 7:10am
Hi there,
Ther are many ways to achieve this funcationality. But on the top of my head, these are the ways:
1. Insert Into DestinationTable Select <Columns> From SourceTable
2. Select <Columns> InTo DestinationTable From SourceTable
3. DTS (Data Transformation Services) Wizard
4. SSIS Package
5. .Net Code (Write a simple application -> make connection to database -> transfer the data just like SQL using SQL queries)
6. Generate Scripts Wizard (Only works in SQL Server version above
2005)
- Generate Script Wizard
- Select your Source table
- Select "Schema & Data"
- Let it create SQL script in new window
- modify the table name by replace
- so the whole script is for new table with data & same structure.
More:
http://www.bigator.com/2012/02/19/enhanced-generate-scripts-dialog-box-in-sql-server-2012-rc0/
Thanks, Khilit
http://www.bigator.com
July 13th, 2012 9:56am