|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Copy a table?
is there a command, or a select, which will spit out all the information, columns and datatypes for each column in the order that I would need if I were originally creating the table?
I'd like to make an exact copy of a table already created, so I can make the copy a different tablename, with all the same attributes. I don't need the information inside the first table to be part of the second table, (the asp will be setting all that up, and is done). Any hints? I think part of my problem has to do with the fact that I don't know the right term for what I'm trying to do. I've tried searching google, but all I keep ending up with is info on copying table data from one table to an already created second table. help! |
|
#2
|
|||
|
|||
|
Have you tried using Enterprise Manager to dump the database to a file and then reimport it into a different database?
|
|
#3
|
|||
|
|||
|
I don't need a new database, I need a copy of a table in the same database. same columns and types but different name.
any clue? Metahari |
|
#4
|
|||
|
|||
|
u can use phpmyadmin to dump the table to obtain its create table syntax, later run the create table sql with modified names.
__________________
Rathaur ====================== Knowledge is Power |
|
#5
|
|||
|
|||
|
You can use Enterprise Manager to generate a SQL script which can be used to recreate the Table.
Right click on the table in Enterprise Manager Select All tasks -> Generate SQL Script In the general tab you should see the name of your table in the objects to be scripted section Click on 'Options' and check the table scripting options you require. Then click Okay Once you have save the script you can edit the table name and hey presto...! |
|
#6
|
|||
|
|||
|
Is this what you need?
[Copy ONLY the structure of table ]
USE [your_db_name] GO SELECT * INTO [your_db_name].[dbo].[newtablename] FROM [your_db_name].[dbo].[oletablename] WHERE 1>2 [Copy the structure and data of table ] USE [your_db_name] GO SELECT * INTO [your_db_name].[dbo].[newtablename] FROM [your_db_name].[dbo].[oletablename] |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Copy a table? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|