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)
 Recreate SQL Dependencies

Author  Topic 

jcrossman
Starting Member

3 Posts

Posted - 2008-10-23 : 08:48:01
I have an SQL 2000 Altiris Database. It had a table with eight Columns called dbo.application. It has one Constraint and six Dependencies.

I some how managed to corrupt this table, so I deleted it and then recreated it within "SQL Query Analyzer". I managed to re-create the Columns and Constraints in the table but I don't know how to recreate the Dependencies.

I have another server with an Altiris Database that I can refer to. So I am able to tell what Dependencies I should have.

Does anyone know the SQL commands I need to re-create the necessary dependencies?

Thanks in advance, Jason.

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-10-23 : 09:15:37
Script out the SQL for the "good table". Strip out the CREATE table bit....and then use the rest.

Or invest in the www.RedGate.Com SQLCompare package....and it will assist synchronising the table structures. it's reasonably priced and available on trial.


And invest time and effort in putting your databases structures into a source-control package of oyur choice. As well as invest in a BACKUP policy that delivers business reliability.
Go to Top of Page

jcrossman
Starting Member

3 Posts

Posted - 2008-10-23 : 09:35:58
Sorry i'm pretty new to SQL (about 6 hours!!) and i'm not sure what that means? I used CREATE TABLE to add the "application" table and columns. Then I used ALTER TABLE with ADD CONSTRAINT to add back the correct Constraint.

Is there another command that I can use to add the Dependencies back? Or is it more complicated than that? I don't mind doing it manually.

I have noticed that there are 'Stored Procedures' that the Dependencies link to. These also have Dependencies that need to be pointed to the "application" table.
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-10-24 : 03:46:02
The phrase "in doodoo" comes to mind. Really go to www.redgate.com and look to trial their SQLCompare product - it'll create the scripts you need to get the tables + dependancies back looking the same. Alternatively look to hire a local expert who can visit you on site for a day and get you back on the straight and narrow (and then get some training). If you're at beginner stage in SQL and you've got into this trouble already then you've an uphill task facing you. But fair dues to you for trying to fix things anyway....making mistakes can be the fastest learning path. (Given you CREATED the table again....do you not have a need to have it full of data? because a CREATE only creates the table structure...it doesn't re-fill it with the original data...you have to go to backup for that)
Go to Top of Page

jcrossman
Starting Member

3 Posts

Posted - 2008-10-24 : 06:20:54
I do not need to refill the table because the database is used by a program called Altiris. Which audits PCs amongst other things. When I run the application audit again from Altiris it does seem to refill tables correctly! Does this mean I don't need the dependencies?
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-10-24 : 08:36:06
"Does this mean I don't need the dependencies?" Can't answer that. You'll have to ask the supplier of the Altiris software.
Go to Top of Page
   

- Advertisement -