Link to home
Start Free TrialLog in
Avatar of cricketman
cricketman

asked on

How do I export tables with keys & indexes in SQL 2005 Mgt Studio?

I am trying to export several tables from one database to another using the Import/Export Wizard in SQL 2005 Management Studio (I'm not a programmer!).  I can export the tables fine, but they don't have the primary keys & indexes once they land in the destination database.

I found an old question here on EE that described generating a script with the source database, then running it on the destination database before I export the tables into it, but I couldn't make that work (got errors, not sure I really grasped the whole process).

Any EASY way to do this?
Avatar of Aneesh
Aneesh
Flag of Canada image

why dont you try backup restore method, that ill give you a duplicate of your database
Avatar of cricketman
cricketman

ASKER

I don't want the whole database - only a few tables.  I don't know of a way to choose only certain tables when performing a backup/restore - can that be done?
ASKER CERTIFIED SOLUTION
Avatar of Steve Hogg
Steve Hogg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, trying to walk myself thru this, could use a little more detailed assistance, please.  
Here's what I'm doing (in SQL Mgt Studio):
1) create new empty database
2) r-click on existing dbase (that I want to copy indexes/keys from)
3) Tasks > Generate Scripts
4) select dbase I want to generate them FROM, right?
---   Do I select "script all objects"?
5) In the "Choose script options" dialog, what items do I set to TRUE?
6) In the "Choose object types" dialog what do I check?  (choices are: roles, defaults, schema, procedures, tables, udf's, users, views)
7) in the "Output option" I chose to script to a FILE (thinking it would save a sql script to this file that I would then run against the empty database I created), but when I then opened the saved file in Mgt Studio it was empty.

Need help please.....
8)
Can anyone confirm the details in my comment above please?

Thanks in advance!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I decided to give up on this... and the B grade is b/c don't feel I got quite as detailed and accurate asssistance as I have in the past here on EE.  I do appreciate your trying though.