• SQL Kiwi (1/11/2012)


    L' Eomot Inversé (1/11/2012)


    Nice and simple.

    I see a lot of people saying this, but either my product knowledge is significantly below average or we're doing something differently. I don't, for example, check BOL before answering - I do it on the spot. That's not to say either way is right or wrong, just a potential point of difference.

    I'm very surprised there's only 34% correct so far, although I would expect the wiggle on whether no other user is connected to a db which is in single-user mode would catch a few who didn't think hard (it returns 1 if an attempt to connect would have succeeded, which makes it pretty obvous that it can't return 1 if someone else is connected in single user mode, but while Vulcans might always get something like that right us poor humans sometimes don't think hard enough), but that doesn't seem to account for enough of the wrong answers.

    This function is one I don't use much. I know what it does, but I hovered between single-user and suspect as the second option to the obvious first correct answer. I have no experience of executing HAS_DBACCESS against a single-user mode database or a suspect one, so I took a guess.

    edit: I should add that I am unsure of the value of this question, beyond one that simply asked a 'nice and simple' question about what HAS_DBACCESS does in normal circumstances. I don't expect to remember the second correct option for any length or time, or that it would ever be important for me to do so. Overall: meh.

    I agree on the "not so obvious". I also didn't use BOL but reasoned it like this -- you can't USE a DB when it is suspect and most of the time you have to USE a DB to run a function against it, so since you can't use a suspect DB you can't run this function against it. Obviously based upon the answer you must be able to run it against any DB regardless of connection context.