Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Missing all primary keys

Author  Topic 

misterzr
Starting Member

49 Posts

Posted - 2006-10-24 : 15:27:57
We are running SQL databases and are mising all but 2 of the primary keys on a couple of the databases.

1. One of the people working on the tables was trying to set primary keys for two of the tables. Is there a way that they could have deleted the rest(these 2 tables are the only keys remaining)

2. Is there a way to copy the keys from another database with all the same tables and keys to replace the ones that are missing?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-24 : 15:36:33
1. Yes, but they would have had to do it manually such as with ALTER TABLE, or by scripting out the drops via the Generate SQL Script wizard then running that.

2. Yes, you can use the Generate SQL Script wizard to create the code for you. Then run that or a modification of it on this database.

Tara Kizer
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-10-24 : 15:47:56
Is it dead yet?
Go to Top of Page

misterzr
Starting Member

49 Posts

Posted - 2006-10-24 : 15:51:14
Not dead but acting flaky, these are the databases for both production and development for our ERP (JDEDWARDS) system
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-10-24 : 16:07:33
If someone screwed up the database by deleting data and/or tables,
I suggest you get professional help from an experienced dba or consultancy,
over a forum like this it is only limited help we can give you.

rockmoose
Go to Top of Page
   

- Advertisement -