SQL Server 2008 r2?

  • Miles Neale (8/27/2014)


    Really???? Wow, got it wrong but my answer was right.

    Like please answer this true and false question:

    The QOD and the answer for today was strange.

    Answers(Please Select Two):

    True

    False

    All the above

    only F

    All the below

    🙂

    Is it funny that I understand this better than the QOTD?

    Select Two (maybe)-

    A) It is Funny.

    B) Change "QOTD" to "poorly worded and/or moderated confusing post yes"

    C) It is Hilarious

    D) What is QOTD funny time answer wrong?

  • Depending on interpretation of the question, there are three or four correct answers, not two. And the explanation of the correct answers is also wrong. Really a missed opportunity,

    "#table dose supports only 116 characters" - this is correct (if we assume that the author intends this as the maximum length of a temp table name). It does not affect the code in the QotD, but it is true.

    "Incorrect syntax near '#AAAAAAAAAAAAAAAA'." - also correct, but not because 116 characters + '#' is 117 - the problem is that the string is declared as 30 positions, so the code sent to EXEC is CREATE TABLE #AAAAAAAAAAA - without the column specification.

    "# table create without errors" - false, because of the above.

    "we can use print and exec commands in single query" - false if you interpret this literally, but true if your interpretation is that the author confuses "batch" and "query".

    "incorrect syntax near '+@tblname'" - false, this syntax is okay.

    "to execute this query without errors we want change replicate and variable sizes" - correct, the variable size has to increase *and* the length of the table name has to decrease. (Allthough one might argue that you can make the query run by changing only the replicate length - for up to 9 positions, the varchar(30) is enough to hold the entire CREATE TABLE statement

    The idea of the query is not bad (though a bit repetitive; we had a very similar question last week). But the execution is rather poor. Too bad.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Thanks for the question Shiva!

    😎

  • Good question, but some very careless wording both in the question itself and in the explanation.

    "We want to ..." is not something that happens. So there's really only 1 correct answer. That's what's wrong with the question. And the explanation doesn't make itself clear enough to prevent some of the comments that have been made.

    But a lot of the criticism in the comments so far is nonsense. In particular the claim someone made that this is the same question as the one we saw 6 days ago is total rubbish.

    I don't understand all the moaning about the explanation; the reason we would change the replication number is that the replication number ensures the table can't be created because the column list won't be included in the Sql string handed to the exec call, and claiming that Shiva means anything else by pointing out that the resulting string would be too long is a bit silly, although it could certainly have been a made clearer (that's all there is wrong with the explanation); equally, there is no imaginable way that anyone can claim that 3 answers are correct - the 117 character string isn't used in the create statement, so rejecting it isn't something that happens. Neither do I understand why people are claiming that two separate statements are a single query; queries are, properly speaking, dml statements but maybe it's fair enough to count ddl statements too. PRINT <something> is not a query, it's neither DML nor DDL but something else, of the same order as GOTO (but not quite a disqualified as GO). Neither is EXEC(<something>) a query, it's a metastatement. And even if both were queries, calling a batch a query is pure nonsense.

    Tom

  • Miles Neale (8/27/2014)


    Really???? Wow, got it wrong but my answer was right.

    Like please answer this true and false question:

    The QOD and the answer for today was strange.

    Answers(Please Select Two):

    True

    False

    All the above

    only F

    All the below

    🙂

    😀

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Uwe Ricken (8/27/2014)


    gbritton1 (8/27/2014)


    The question asks, "What happens", yet one of the "correct" answers is that we need to change the variable and replicate lengths. At the risk of being pedantic, this correct answer is not "what happens" when you execute the query.

    I have to say that the question and answers are very poorly thought out.

    +1

    The original question for the QOTD is...

    If I execute this on SQL Server 2008 R2, what happens?

    Very simple - it fails! So only ONE correct answer is available...

    I know how difficult it is to provide QotD and it consumes lots of time for:

    - replay a given situation in my own box

    - word the correct question

    - underly the question with good coding (which is clear and without errors)

    - word an answer which forms an "educational" character and explains the solution in simple words

    This is all time consuming and - when I provide it - takes at least 30 min of work (I usually use 60 - 90 min for all).

    If a question will be submitted to blame answerers than it would be the best not to submit!

    What I am missing from the QOTD since a few weeks is - in some cases - a clear definied and well prepared question AND the approval of choices to answer. In some cases (and exactly this is one of them) I have the feeling that the primary intention of the authors is not the transfer of knowledge but seeing most of the people failing. I don't know why questions like this smell like pitfalls instead of "good" challenges!

    I would really appreciate a better quality management by the team of SCC!

    Steve, I know you are a busy man and I think your team is, too. But for the quality of QotD I hope you will take care of the quality of the questions and reject them if they are not clear enough!

    If you need assistance than let me know! It maybe possible for me to spent 2 - 3 hrs a week for quality checks :).

    If this will help the community to anser well asked challenges than it is worth the time!

  • TomThomson (8/27/2014)Neither do I understand why people are claiming that two separate statements are a single query; queries are, properly speaking, dml statements but maybe it's fair enough to count ddl statements too. PRINT <something> is not a query, it's neither DML nor DDL but something else, of the same order as GOTO (but not quite a disqualified as GO). Neither is EXEC(<something>) a query, it's a metastatement. And even if both were queries, calling a batch a query is pure nonsense.

    Strictly speaking about query and batch you are right, but I doubt if that reasoning was on the mind of Shiva.

    But strictly speaking "use" can mean anything, so below a query in which I use both PRINT and EXEC commands.

    SELECT 'Yes I can use the PRINT and EXEC command in a single query'

    😀

  • Mighty (8/28/2014)


    TomThomson (8/27/2014)Neither do I understand why people are claiming that two separate statements are a single query; queries are, properly speaking, dml statements but maybe it's fair enough to count ddl statements too. PRINT <something> is not a query, it's neither DML nor DDL but something else, of the same order as GOTO (but not quite a disqualified as GO). Neither is EXEC(<something>) a query, it's a metastatement. And even if both were queries, calling a batch a query is pure nonsense.

    Strictly speaking about query and batch you are right, but I doubt if that reasoning was on the mind of Shiva.

    But strictly speaking "use" can mean anything, so below a query in which I use both PRINT and EXEC commands.

    SELECT 'Yes I can use the PRINT and EXEC command in a single query'

    😀

    Strictly speaking you are using the two WORDS in a select not the two COMMANDS....

    Strictly speaking a Query and a Batch are different concepts....

    Strictly speaking this is pure nonsense....

  • I got

    CREATE TABLE #AAAAAAAAAAAAAAAA

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near '#AAAAAAAAAAAAAAAA'.

    The pain of Discipline is far better than the pain of Regret!

  • The idea of the query is not bad (though a bit repetitive). But the execution is rather poor. Too bad.

    Thanks for the question

    Thanks

Viewing 10 posts - 31 through 39 (of 39 total)

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