Apologies for getting back late on this, I was buried under some assignments clubbed with hectic travel schedule. So, sometime back I had posted this to be solved by you…
Many of you commented on the original post which is here;
And you all gave me interesting tips including Refreshing SSMS, checking for preceding space in from the db name, not to use sp_renamedb, checking the connection, checking permissions, etc. And trust me, even I had looked into all of them and many more when I encountered this for the first time.
But what helped me was to check sys.databases system catalog and PM Shawn (one of the readers) suggested that. But still it was tricky. This is why…
So when I executed select * from sys.databases, I did get HOCBASE listed as follows:
And you can observe that there is a space but SSMS object explorer does not show that.
As I said before things were trickier than it appeared. Knowing that there is a space, I executed sp_renamedb again and explicitly put a space.
Things didn’t work. It was a bit of brain pain before I tried this:
And it worked
Yes, there was a CRLF (ENTER) between HOC & BASE. But how did that happen? A Junior DBA who believes he is the fastest on keyboard did this – and I call this pace without accuracy – so while renaming the DB, he mistakenly pressed ENTER and executed it. He was fast enough not to notice what he was doing.
There could be other ways of identifying that there was a CRLF in the database name but I did not know of any and sys.databases showed a space. If there is a way you know, do let the readers know by commenting.
Hope you enjoyed this
Like us on FaceBook | Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook