Status and Name Please

  • Thank you for the post, Andy, interesting one.

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • PHYData DBA (6/11/2014)


    Andy Warren (6/11/2014)


    PhyData, I take your point on that, I wish I had found a better reference for the answer. Shift F1 probably relevant more for QOTD than real life? I'll have to experiment, see if I want to retrain myself for work related searches or not.

    I had to change this post. The 2014 SQL server documentation does not have this wonderful piece of information that has been in every other version of the documentation.

    The following example finds the name of the current user without specifying an ID.

    SELECT USER_NAME();

    GO

    Here is the result set for a user that is a member of the sysadmin fixed server role.

    ------------------------------

    dbo

    Apparently it is a thing now to make every new version of the T-SQL documentation more lightweight than the last.

    Marvelous! :sick: I mean UseLess!!

    I guess you looked at the wrong page - the page in the 2014 verion of the transact-sql reference documentarion says

    BOL


    B. Use USER_NAME without an ID

    This example finds the name of the current user without specifying an ID.

    SELECT user_name()

    GO

    Here is the result set (for a user who is a member of the sysadmin fixed server role):

    ------------------------------

    dbo

    That's at http://msdn.microsoft.com/en-us/library/ms188014%28v=sql.120%29.aspx; change 120 in that URL to 110. 105, 100, or 90 and the same text is there. The same piece of text is on the SQL 2000 version, http://msdn.microsoft.com/en-us/library/aa260648%28v=sql.80%29.aspx - as for many other BOL URLs for SQL 2000 that one (the URI, not the content) changed completely for SQL 2005 and following versions instead of just changing the version number. So in the reference BOL page for this function the information is still there, in exactly the same words as were used in the reference version 14 years ago.

    Tom

  • Andy Warren (6/11/2014)


    About the assumption, I'm not sure it was good to have in the answer, because the question had "You're the DBA with sysadmin access". But thinking beyond that, sometimes I want readers to infer things about the question. That makes it harder, more interesting, and less of a pure test taking skill question (maybe). Is infer better than assume? "This question depends on the reader correctly inferring..." vs "This question depends on the reader correctly assuming...". Reading those two, I think I do like infer better, as it does point toward derived knowledge and not just "I'm doing the SSC question of the day which means I'm an SA".

    There's nothing in the question from which we can infer that, so we just have to assume it. It is of course a reasonable assumption, but on your past question track record you might well have thrown in the statement that we had sysadmin access as a red herring. 😛 Of course Of course maybe we don't have access to the particular instance other than sysadmin access, and assuming we have some other access would be a biiger assumption that assuming we were using the acess you told us we had, so it's the most sensible asssumption, and it's perfectly reasonable to have a question reqire us to choose the most sensible assumption - but see but clause in previous sentence. :w00t:

    It's a nice question, anyway.

    Tom

  • TomThomson (6/11/2014)


    I guess you looked at the wrong...

    Tom. You are right.

    My I was in a rush to take back my nega post yesterday about it really being there.

    This even contradicts what was seen yesterday at the link supplied by our QOTD author.

    I look at all the online documentation for this function all of it contains that text and looks very similar.

    I hope you understand surprised I was to see you argue that all versions of the BOL is correct about something. 😎

  • Tom, I'll try to remember that point. It also reminds me to write some non-SA questions!

  • PHYData DBA (6/12/2014)


    TomThomson (6/11/2014)


    I guess you looked at the wrong...

    Tom. You are right.

    My I was in a rush to take back my nega post yesterday about it really being there.

    This even contradicts what was seen yesterday at the link supplied by our QOTD author.

    I look at all the online documentation for this function all of it contains that text and looks very similar.

    I hope you understand surprised I was to see you argue that all versions of the BOL is correct about something. 😎

    Actually there are so many BOL pages that it would be very odd if none were right, and sometimes a right page hasn't changed in a long time. Of course this is the inverse of the excuse often offered for BOL, that there are so many pages that it's inevitable that some are wrong. 😀

    Tom

  • great question Andy..

    Thank you.

  • easy one.

    Thanks.

  • domenico.delbrocco (6/11/2014)


    I need to study more about USER_NAME() and SUSER_SNAME() functions

    Same here.

Viewing 9 posts - 16 through 23 (of 23 total)

You must be logged in to reply to this topic. Login to reply