|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:24 AM
Points: 5,232,
Visits: 7,022
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 10:33 AM
Points: 10,989,
Visits: 10,529
|
|
First correct answer! Yay for me 
I liked this question - especially the first part about IDENTITY allowing duplicates, which I am sure will surprise many people.
I am less sure about the wording in the second part of the question, "SQL Server does not have an efficient way to retrieve rows based on a known value for PersonID." because that rather depends on the number of rows in the table.
I don't think it would have been giving too much away to say something like "SQL Server cannot use an index to locate rows based on a known value for PersonID".
Paul
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Thursday, May 16, 2013 1:46 PM
Points: 18,732,
Visits: 12,329
|
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 1:50 AM
Points: 581,
Visits: 301
|
|
I am agree with the first statement but the second statement "SQL Server does not have an efficient way to retrieve rows based on a known value for PersonID." confusing me.
Deepak Kumar Sharma
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Thursday, May 16, 2013 1:46 PM
Points: 18,732,
Visits: 12,329
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 10:33 AM
Points: 10,989,
Visits: 10,529
|
|
CirquedeSQLeil (4/19/2010) ...but that is not true of an identity column, unless the identity column is a part of a Primary key. Or a UNIQUE constraint, as the QotD explanation says
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Thursday, May 16, 2013 1:46 PM
Points: 18,732,
Visits: 12,329
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 10:33 AM
Points: 10,989,
Visits: 10,529
|
|
CirquedeSQLeil (4/20/2010)
Thanks for tidying that up  You can always rely on me
Paul White SQL Server MVP SQLblog.com @SQL_Kiwi
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 1:21 AM
Points: 169,
Visits: 1,739
|
|
Hang on a minute ...
"Even though the IDENTITY property is intended to be used for key columns, SQL Server will not automatically generate a constraint to enforce the uniqueness, so duplicate values (caused by the methods above) will not be banned from the table. SQL Server will also not automatically create an index to speed up access based on the IDENTITY value (though it will do so when you add the PRIMARY KEY or UNIQUE constraint to enforce uniqueness of the IDENTITY column, as it does for each PRIMARY KEY or UNIQUE constraint). "
the question asked if SQL server had an efficient way to query records, not if it would use that method automatically!
Assumption is the mother of all F***ups
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 3:15 AM
Points: 1,476,
Visits: 1,943
|
|
Even though i actually got this right the wording of the question aint that good. And that could be part of the reason why the correct/incorrect ration is out off wack (81% wrong at the time).
The heading said "Using IDENTITY as a key column". Key part there being "key". Now combined with the fact that the create table statement was incomplete "-- other columns);". Got me wondering if the author had a missing "primary key (PersonID)" at the end (or something similar). Or that is was implied that there would be code to create a key. Which of course would have inverted the answer.
Though this could be a result from lack of english skills on my part.
Though i must say i liked the question since i got it right
|
|
|
|