M$ $QL $erver

Yes, that dirty word. MS SQL Server. Never thought you’d hear that one here did you? Its been about 6 years since I’d last touched the beast, and of course I’m loving every minute of it.

I was handed a DB to work on that I should have been able to attach right into my instance. No problem. Except many of the objects were owned by users in the newly attached DB that didn’t have a login on my instance and this was a problem. And, well, wouldn’t you know, there doesn’t seem to be a way to assign a login to an existing DB user, at least not without dissecting the system tables. Go figure.

I found this little SQL script from Scott Forsyth and David Penton handy in resurrecting my orphaned tables quickly w/o manually running sp_changeobjectowner over and over. Now they’re happily owned again and healthy. Scott and David, you rock. Thanks.

Leave a Reply

You must be logged in to post a comment.