ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister


Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters




General discussions > Public newsgroups > microsoft.public.sqlserver.server > Copy table?

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread



Author Copy table?
SLE
Guest




Registered: Not Yet
Location:
Country:
State:
Certifications:
Working on:

Total Posts: N/A
Copy table?

Hi there,

I need to create a new table which has [almost] the same structure as an
existing table, in the same database. As both tables have a large amount of
columns, I wanted to copy (save as) the original table into the new one and
adjust some column definitions afterwards. How can I copy/save as an
existing table into a new one (no need to copy the data of course) using EM
or QA?


Thanks,

--
SLE


Report this post to a moderator

Old Post 11-20-02 09:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
TimGJ
Guest




Registered: Not Yet
Location:
Country:
State:
Certifications:
Working on:

Total Posts: N/A
Re: Copy table?

There are two main ways I'd consider, one may be better than the other
depending on how much your new table differs from the current table.
Using EM - script out the existing table using right mouse click on the
current table - All Tasks - Generate SQL script. Either save script to file
or preview and copy to clipboard then past to QA. NB if you want indexes,
constraints, triggers etc. you'lll have to turn the appropriate options
under the 'options' tab of the Generate SQL scripts dialogue box.
You will then have SQL that you can change BEFORE you create the new table.

The other, probably quicker (depending on your typing speed) method is to
type into QA the following SQL.....
SELECT * INTO <new table name> FROM <current table name> WHERE 1=2<
You can then change the structure as you like using EM.
The WHERE clause ensures no data is copied.

Hope this helps.
Regards,
Tim Gordon-Jones BSc(Hons), MCDBA
Professional Database Solutions
Web: http://www.pdbsolutions.co.uk

"SLE" <infoNOSPAM@proit.be> wrote in message
news:3ddb4a74$0$190$ba620e4c@n
ews.skynet.be...
> Hi there,
>
> I need to create a new table which has [almost] the same structure as an
> existing table, in the same database. As both tables have a large amount

of
> columns, I wanted to copy (save as) the original table into the new one

and
> adjust some column definitions afterwards. How can I copy/save as an
> existing table into a new one (no need to copy the data of course) using

EM
> or QA?
>
>
> Thanks,
>
> --
> SLE
>
>



Report this post to a moderator

Old Post 11-20-02 10:23 AM
Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply


Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is OFF.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps