A client phoned me yesterday, wanting some enhancements to one of their mobile applications. Simple I thought, have a quick check of feasibility by looking at the copy of the test database I have running on my laptop. I then remembered that I've recently rebuilt my laptop and hadn't the customers database attached to my copy of SQL 2005.
This is where it gets interesting, the solution replicates part of a SQL database over to a bunch of mobile business applications built on SQL Compact. I attached the database and it all went pear-shaped. I was unable to publish any tables.
After much hair pulling I got myself back to a working state by going to the master database and running the following SQL command -
sp_removedbreplication @dbname ='NAMEOFTHEDATABASE'
This took me about 3 hours to arrive at this conclusion. Moral of the story, use SQL backups rather than trying to just re-attach to existing databases.