INTO Identities

  • Danny Ocean (5/13/2013)


    I think nobody check the question before published and everybody should get point for this.

    You just got your point back by posting. If you want some points, you are welcome to as many of mine as you wish. 🙂

    _______________________________________________________________

    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/

  • Koen Verbeeck (5/13/2013)


    Danny Ocean (5/12/2013)


    Good Basic question. But i surprised that still 51% people are wrong. :w00t:

    Yes, because I use INTO combined with a GROUP BY daily to create new tables... :rolleyes:

    +1 :hehe:



    Everything is awesome!

  • I was wrong here. but the right query will be

    SELECT

    customerID, count(city) as 'Count'

    INTO CustomerCities

    FROM Customer

    GROUP BY CustomerID

    other wise it will not execute.....

    definitely CustomerCities will have Identity column as customer table

    (mine cause for wrong answer was query provided because i was not able to execute that one and i guessed wrong answer).

  • Actualy it should be:

    SELECT

    customerID, count(city) as 'Count'

    INTO CustomerCities

    FROM Customers

    GROUP BY CustomerID

  • This questions answer is WRONG. I read others saying well you assume this or you take that...NO. The bottom line IS there is NO IDENTITY because the statement will not execute. It's a black and white YES/NO. I understand the authors intent and simple error...but perhaps he was trying to see how many people knew there would be an error without running it. As stated in the quiz, to say the statement produces an identity column in the output is incorrect.

  • Interesting, I knew it was carried over for simple select queries, but would not have expected the IDENTITY to be included for a query including a GROUP BY.

  • Common... be generous guys :cool:. Though there was code typo, but considering the question asked and options provided:

    "Does the CustomerCities table have a column with the identity property? "

    the code typo should have been avoided. I definitely think many have learned from this question. 🙂

  • Odd behavior. Thanks for the question Steve!

  • Toreador (5/13/2013)


    I wrongly assumed the point of the question was that the table wouldn't have an identity column because it wouldn't be created at all due to the lack of a column alias 🙁

    Same here, lost a valuable point just because of wrong formatting of questions and answer choices. :angry:

  • Mr. Kapsicum (5/13/2013)lost a valuable point

    How valuable exactly? Would you like to make an offer for some of mine?

    😉

  • Mr. Kapsicum (5/13/2013)


    Toreador (5/13/2013)


    I wrongly assumed the point of the question was that the table wouldn't have an identity column because it wouldn't be created at all due to the lack of a column alias 🙁

    Same here, lost a valuable point just because of wrong formatting of questions and answer choices. :angry:

    And "earned" it back just by complaining about "losing" it. 😀

    Honestly, the points mean nothing. Maybe Steve will find a way for us to trade in some points for a SSC t-shirt or something.

    _______________________________________________________________

    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/

  • This was removed by the editor as SPAM

  • My apologies for the typo.

    The question has been corrected and points awarded back.

  • In fact, in SQL Server 2008 R2 an identity property is added too.

  • Thanks to Steve for fixing the typo.

    That aside, I think the focus of many in this discussion was on the wrong thing. How many people have those tables in their current database or in a test database?

    Based on an assumption that most people wouldn't be able to just copy n paste this query, just read the query for the intent and stop complaining about missed points due to a typo.

    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

Viewing 15 posts - 16 through 30 (of 44 total)

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