Which Statement will execute sucessfully

  • malleswarareddy_m

    SSCertifiable

    Points: 5847

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

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

  • demonfox

    SSCertifiable

    Points: 6289

    easy one for friday ...

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

  • kalyani.k478

    Default port

    Points: 1400

    easy +1:)

  • kapil_kk

    SSC-Insane

    Points: 21316

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

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

  • Dineshbabu

    Hall of Fame

    Points: 3220

    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..

  • Lokesh Vij

    SSChampion

    Points: 10836

    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

  • honza.mf

    SSCertifiable

    Points: 5519

    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

  • Stuart Davies

    SSCoach

    Points: 18874

    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 questionThere 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

  • Dineshbabu

    Hall of Fame

    Points: 3220

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

    --
    Dineshbabu
    Desire to learn new things..

  • Jeff Stratford

    Say Hey Kid

    Points: 690

    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 🙂

  • Richard Warr

    SSCertifiable

    Points: 6955

    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.

    _____________________________________________________________________
    MCSA SQL Server 2012

  • Gazareth

    One Orange Chip

    Points: 27737

    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.

  • call.copse

    SSCoach

    Points: 16916

    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.

  • DrKiller

    Right there with Babe

    Points: 780

    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 34 total)

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