Re: [Emerald] Help Dale

Dale E. Reed Jr. ( (no email) )
Wed, 03 Mar 1999 21:26:23 -0800

Greg wrote:
>
> We have one MBR that had 300 sub's under it and some nitwit deleted it.
> I have a copy of the database from yesterday. How would I go about getting
> that one MBR and everything that is under it restored without restoring the
> entire database.

As a preference to this, since its come up several times. I HIGHLY
recommend that everyone audit their security of SQL Server and remove
permissions for deleteing/changing items like invoices, masteraccounts,
subaccounts, payments, etc for those people who absolutely don't need
them. A little time will save a lot in the long run.

The only way I can think about doing this the following. This is
assuming yoru backup database is Emerald2 and the CustomerID is x.

1) Create a second database and restore the backup into it.

2) Open up isql_w and run the following.

Use Emerald
Go

SET INSERT_IDENTITY MasterAccounts On

Insert INTO MasterAccounts
Select * From Emerald2..MasterAccounts
Where CustomerID = x
GO

SET INSERT_IDENTITY MasterAccounts Off
SET INSERT_IDENTITY SubAccounts On
GO

Insert INTO SubAccounts
Select * From Emerald2..SubAccounts
Where CustomerID = x
GO

SET INSERT_IDENTITY SubAccounts Off
GO

-- 

Dale E. Reed Jr. Emerald and RadiusNT__________________________________________IEA Software, Inc. www.iea-software.com

For more information about this list, including removal,please see http://www.iea-software.com/maillist.html