Wednesday, 5 March 2008

How to enable SVN Headers on source code

Quite easy really once you know how. Go to the top level of your checkout directory. Click properties, and select the subversion tab. See if svn:keywords is added - if it isn't then add it and in the value put the keywords you want to add. If it is there then just change the value. If directory click the recurse option and it will set the whole archive.

svn:keywords Date Revision Author HeadURL Id

Useful article: http://svnbook.red-bean.com/en/1.1/ch07s02.html

Getting rid of annoying orphaned users on a SQL Server 2005 database

A nice one of those microsoft errors this one!!

Trying to delete an old user on a database which i have restored, but there is a problem, it throws an error, 'Drop failed for User ABC' (Microsoft.SqlServer.Smo)

The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)

Oh Joy! Ok after digging around I tried this which returned a list of orphaned users:

select u.name from master..syslogins l right join
sysusers u on l.sid = u.sid
where l.sid is null and issqlrole <> 1 and isapprole <> 1
and (u.name <> 'INFORMATION_SCHEMA' and u.name <> 'guest'
and u.name <> 'system_function_schema')

With that I can use the exec sp_revokedbaccess 'ABC' - make sure they do not own any of the schemas in the database. You may need to move this onto another user.