How to stop adding users and other security stuff

Brian DonahueBrian Donahue Posts: 6,590 New member
Hi Ian,

Right, do not migrate the users, filter them out by not selecting the
difference for migration:

obDatabaseDifferences = dbSourceDatabase.CompareWith(dbTargetDatabase,
enOptions);


foreach (Difference d in obDatabaseDifferences)

{

if (d.Type==ObjectType.User || d.Type==ObjectType.Role) d.Selected = false;

else d.Selected=true;

}

Regards,

Brian Donahue

Red Gate Technical Support

P.S. -- This question really belongs in the SQLCompare or Toolkit newsgroup!
:-)



"Ian Spence" <[email protected]> wrote in message
news:l%23pQZ%[email protected]

> This problem has come about from the following error:
>
> Unhandled Exception: System.Data.SqlClient.SqlException: User does not
have
> permission to perform this action.
> at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
> at RedGate.SQL.Shared.Utils.ExecuteBlock(ExecutionBlock block, String
> server, String database, Boolean integratedSecurity, String userName,
String
> password)
> at Sync.CompareStructure.Synchronize(Database db1DatabaseParams,
Database
> db2DatabaseParams, IList tableNames)
> at Sync.Sync.Main(String[] args)
>
> "Ian Spence" <[email protected]> wrote in message
> news:[email protected]
> > The RedGate.SQLCompare.Engine is attempting to create users and roles.
> How
> > can I stop this ? I have tried different Options e.g.
> >
> > Differences differences=db1.CompareWith(db2,
> > Options.Default|Options.IgnorePermissions);
> >
> > The output SQLServer commands are listed here.
> >
> > ---
> > if not exists (select * from master.dbo.syslogins where loginname =
> N'ian')
> > exec sp_addlogin N'ian'
> > GO
> > sp_grantdbaccess N'ian', N'ian'
> > GO
> > sp_addrolemember 'db_owner', 'ian'
> > GO
> > sp_droprolemember 'db_owner', 'EBLUser'
> > GO
> > sp_droprolemember 'db_accessadmin', 'EBLUser'
> >
> >
>
>
This discussion has been closed.