I am trying to run the below code. It works for me but not for at least some of my users it doesn't work. It doesn't seem to error just no actually remove the DB's.
string sqlConnectionString=@"Data Source=.\SQLEXPRESS;Initial Catalog=master;Integrated Security=True"; var theSQL="DROP DATABASE DBName1, DBName2, DBName3, DBName4"; SqlConnection conn=new SqlConnection(sqlConnectionString); Server server=new Server(new ServerConnection(conn)); server.ConnectionContext.ExecuteNonQuery(theSQL);
Alternatively, what I really need is to remove the existing Replication Sets on those DB's so that I can setup the new ones. We moved to a new SQL Server but the database names are the same.
The subscription could not be initialized using an initial snapshot because one or more tables in the subscription belong to another publication, and therefore cannot be dropped. Consider initializing the subscription manually without using a snapshot.
Error they receive, though this would be after the above was supposed to run as this is during the Sync that happens next.