When upgrading from MS SQL Server 2008 to MS SQL Server 2012, I decided to retain the data directories I was using in SQL 2008. I therefore did a backup and detached all my private databases, removed SQL 2008 and did a clean install of MS SQL 2012. I logged into the new server and on trying to attach back any of my databases, I encountered the following error: CREATE FILE encountered operating system error 5 (Access is denied) while attempting to open or create the physical file .
Sometimes we waste a lot of time trying to get to the root cause of exceptions. Some exceptions are so misleading that they end up sending you on a wild goose chase. When I encountered the following exception during SQL Server data importation process, Invalid character value for cast specification. The wording led me to believe that one of the characters had a casting problem. Going through the code, I could not locate any place where I was casting single characters.
I was working on the Microsoft SQL Server (2008) Management Studio when I renamed some tables. After renaming I decided to edit the relationships and I got stuck with the following error The existing relationship must have at least one pair of related columns No matter what I did, I could not discard the screen with this message. To reproduce the error, use the following steps but take note that you will end up in an endless loop and you will be forced to kill the SQL Server process.