04.04.06
Posted in Programming at by chenty
I noticed that in my previous posts, a lot of codes I posted cannot be used directly. Why? Because Wordpress formats my regular quotes in open and close quotes. When people cut and paste my codes, these open & close quotes will mess up the codes.
Before I was trying to write a complaint, I decided to look for some info, until I found this:
http://codex.wordpress.org/Writing_Code_in_Your_Posts
Basically, the article addressed this issue, and if I want to use regular quote, I can simply use <pre> tag.
I promise from now on, I will make sure I post in a proper way.
Laziness is sin…
Permalink
Posted in Programming at by chenty
Every time when I restored database backups from hosting companies, I had to delete the user and then recreate the same user in order to make it work. This is because the restoration out of sync since it is from different SQL Server. However, When I examined a backup from hosting company today, I found no database user except dbo in Users. I thought this was good, so I could go ahead add user from Security->Logins without deleting the old one. Unfortunately, when I tried to add User, it returned error “user or role ‘foo’ already exists in the current database”. What was wrong?
I quickly took a look at Roles, and found the old user ‘foo’ still in Roles. I could delete ‘foo’ from db_owner, but I was not allowed to delete “public” role. Yes, you cannot remove users from public role.
Solution: It’s very simple.
1. Create user ‘foo’ (or it’s already created) in Security -> Logins (but you cannot assign it to the database or it will complain “user or role already exists in the current database”).
2. Open “SQL Query Analyzer”, type: sp_changedbowner ‘foo’
Now, ‘foo’ should be in Users of target database.
3. Open Roles -> db_owner, and add ‘foo’.
I hope this helps.
Permalink