Which Statement will execute sucessfully

  • Comments posted to this topic are about the item Which Statement will execute sucessfully

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • easy one for friday ...

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • easy +1:)

  • easy one for the end of the week :-):hehe:

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Hi,

    I accept ur answer, object name will be unique to the schema. What is the schema mapped for the current login user. U said we have only two schemas. then only first statement will execute final one will fail. could u Pls xplain in detail.

    Thanks

    Dinesh

    --
    Dineshbabu
    Desire to learn new things..

  • What would happen, if the current user is mapped to any one of the two schema's by default? Last statement would always throw an error!!

    As this option was not one of the choice, I marked all three statements will execute successfully.

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Lokesh Vij (12/7/2012)


    What would happen, if the current user is mapped to any one of the two schema's by default? Last statement would always throw an error!!

    As this option was not one of the choice, I marked all three statements will execute successfully.

    +1

    Correct answer: success, success, it depends

    "It depends" is my favorite answer.



    See, understand, learn, try, use efficient
    © Dr.Plch

  • Assumed I had rights to person and beneficiary schemas and got it right.

    Otherwise the answer could be it depends,it depends,it depends

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • This was removed by the editor as SPAM

  • Since there is no such option. I too marked as all excute successfuly.

    --
    Dineshbabu
    Desire to learn new things..

  • In which case the default schema is used, which if not set by the user would be dbo. Schema reference: http://msdn.microsoft.com/en-us/library/ms190387(v=sql.105).aspx 🙂

  • Bit worrying how many people found this easy without giving any consideration to what the default schema might be for the user. Easy to get it right if you assume dbo but that's a BIG assumption in the real world.

  • Not a bad question, but I might have answered S,S,F if it had been an option - no mention of default schema or rights on dbo schema.

  • I thought the question was clearly not about rights, but uniqueness in schemas, and thus not ambiguous, of course it might have been helpful to indicate rights were available. Though you might need to add that the network does not drop, disk space is still available, aliens don't squash the server etc if you are pushing it that far.

  • It should be added to the explanation that when you create a table without specifying the schema name, it uses the default schema for the database (which is most probably dbo) and that is why the third statement wouldn't fail with something like "table already exists"

Viewing 15 posts - 1 through 15 (of 33 total)

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