Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Laplink Gold 2008 - $15 Off with Coupon Code CJM9NE
  #1  
Old August 6th, 2002, 05:07 PM
Metahari Metahari is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Wisconsin
Posts: 2 Metahari User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #2  
Old August 7th, 2002, 02:27 AM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Have you tried using Enterprise Manager to dump the database to a file and then reimport it into a different database?

Reply With Quote
  #3  
Old August 7th, 2002, 08:07 AM
Metahari Metahari is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Wisconsin
Posts: 2 Metahari User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old August 17th, 2002, 12:09 PM
rathaur rathaur is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Malaysia
Posts: 81 rathaur User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 31 sec
Reputation Power: 7
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

Reply With Quote
  #5  
Old August 18th, 2002, 08:15 PM
katrina katrina is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: sydney
Posts: 1 katrina User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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...!

Reply With Quote
  #6  
Old March 28th, 2008, 06:59 PM
edison2k3 edison2k3 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 2 edison2k3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 18 m 56 sec
Reputation Power: 0
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]

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Copy a table?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway