Tables

  • Comments posted to this topic are about the item Tables

  • It will get created. Is there a reason, it would not get created ?

    SQL DBA.

  • SanjayAttray (6/16/2010)


    It will get created. Is there a reason, it would not get created ?

    Well with 17% wrong answers i would say that some people think that there could be a reason it would not be created. So a good question (bad question would be one with 100% correct answers)

  • Straightforward simple question.

    Thanks

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Bull-Eye question ; But a nice starter about DEFAULTS!

  • easy one.....

  • The answer has to be Yes, because if there was any sort of syntax error that stops it being created, then both the other two answers would be correct, and they're radio options, not check boxes 🙂

  • Again, looking for a trick in the question, as again the answer seemed too easy.

    As temp tables are dropped at the end of the session, I assumed this is what the question was referring to... and answered as if "would the table exist"... rather than "would the table be created", which of course it would.

    Noticed the DEFAULTS of NULL but didn't pay much attention to them as thought it was unusual but okay.

    Ho hum! :ermm:

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • Thanks for taking the time to write a question. This one was easy... even for me. 🙂

    Like someone else already asked... what about the code would lead someone to think it wouldn't create the temp table? I'm simply curious.

  • tommyh (6/16/2010)


    SanjayAttray (6/16/2010)


    It will get created. Is there a reason, it would not get created ?

    Well with 17% wrong answers i would say that some people think that there could be a reason it would not be created. So a good question (bad question would be one with 100% correct answers)

    I think out of 17 % more than 10 % would have voted no or error as they would not be expecting this simple question in SSC and had thought there is some trick, which in this case is not.

    SQL DBA.

  • I too kept looking at the syntax thinking there must be something in there...then wondered if it were one of the questions about exactly how it was worded and intended. When all was said and done I decided there was no syntax error so of course it would be created. Nice straight forward question.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • I think too many (myself included) are looking for trick questions. Nice simple question today. Thank you for that.

    Converting oxygen into carbon dioxide, since 1955.
  • Personally, I thought it was a trick trick question. Too easy to be that easy, but the writer was expecting me to think that so I decided it was that easy.

    I think what the author was trying to point out is that you wouldn't normally set the default value of a column to null. Correct me if I am wrong, but the default value for an empty column when a row is added is NULL?

  • This is a good basic question, thank you.

    I also paused for a minute before answering trying to figure out what could be a possible reason for this table not to be created? Default constraints can be null. The real question is why would anybody do it? What I mean is that if you remove the word default and the parenthesis around word null then you get pretty much same effect. For example,

    create table #TempTable

    (

    Tempnum int null,

    Tempname varchar (10) null

    );

    go -- table created;

    insert into #temptable default values; -- record inserted

    go

    The insert above clearly inserts a record with default values which happen to be null out of the box due to columns' definitions, so Tempnum int null is sufficient to instruct the engine that for any inserts null is used in absence of value. Maybe somebody knows a valid reason to create a table with column default (null). The only reason I can come up is that assumming white background and dark letters in the editor, typing extra words saves a little bit of electricity if left on the screen for long enough time, so Tempnum int default (null) is more environmentally friendly than simple Tempnum int null 🙂

    Oleg

  • We are getting a lot of new people writing questions, so there isn't this history of "trying to make it hard" with them. Kind of good.

    Nice question, I saw it a few months ago, and went to answer today, thinking there was some trick as well.

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

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