|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: 2 days ago @ 8:01 AM
Points: 989,
Visits: 1,795
|
|
cfradenburg (4/10/2012) I should have gone back and double checked. I assumed it was just asking about a view updating the underlying table, not about the update violating the column constraints. So that's one incorrect answer due to poor reading.
Yup, ditto here. I checked the view definition and forgot to check for nullability.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 3:12 PM
Points: 8,957,
Visits: 8,523
|
|
SandyD (4/10/2012) I think the higher than expected number of incorrect answers may be due to people finding the question a little unclear. Here is another way of phrasing what I am guessing was intended:
Is the value for Col2 updated in the row where the value of Id =1 ?
As the question was written, "where the value of Id =1 updated" implies that the value of Id = 1 somehow updated as part of the update statement. I'm not sure that's what was intended.
I had absolutely no ambiguity at all in the question. When I read your comment I was a bit surprised how confusing that was. Then I went back and looked at the question again and you only included the second half of the question. The original question reads...
Is the value for Col2 in the row where the value of Id =1 updated ?
How can that imply that the column Id was updated? I suppose that non native English speakers may find that a little more difficult but it is crystal clear to me.
Great question Ron. It seems that there are still a lot of people who needed to learn this (23% incorrect at the time of this posting).
_______________________________________________________________
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 Moden's splitter.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 4:53 PM
Points: 7,182,
Visits: 7,281
|
|
bitbucket-25253 (4/10/2012)
Not as easy as I thought it would be: Correct answers: 75% (272) Incorrect answers: 25% (91) Total attempts: 363
Since one of the major objectives of the QOD is to teach I guess some 91 people learned something new, or just maybe have not had their morning cup of coffee. Good question. But I don't find 25% getting it wrong at all surprising.
I imagine what most of those 91 learnt was to be a bit more careful in their reading: a lot of people will have seen at a glance that the view is an updatable view of a single table and that the where clause of the update query unambiguously defines which underlying data is to be updated, and gone for "yes" because the question is about updating through a view, then kicked themselves because they had carelessly failed to check that the new value was legal for the column. I've seen so much of that sought of carelessness in practice that I reckon that's a very important lesson for DBAs and Developers to learn (especially those doing 2nd or 3rd line support, who often have quite extensive power to modify production systems, and those doing QA, who have the power to let all sorts of rubbish get into production if they are careless). So keep up the good work with more questions like this.
But the choice of reference was not really a good one; that BoL page doesn't tell you anything about this QotD except to go look at a different BoL page.
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
http://es.linkedin.com/in/tomthomsonsoftware
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, May 02, 2013 3:45 PM
Points: 3,748,
Visits: 928
|
|
Great question, Ron. Back to basics, for views make sure you also know the table definition and/or possible restrictions for it (nullability, PKs/FKs, etc.). You don't take for granted a table can be updated through a view just because the view allows updates, right?
"El" Jerry.
"El" Jerry.
"A watt of Ottawa" - Gerardo Galvan
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:53 AM
Points: 1,176,
Visits: 778
|
|
| great question. cheers Ron!
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 12:32 AM
Points: 18,855,
Visits: 12,439
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Thursday, June 06, 2013 1:47 PM
Points: 392,
Visits: 388
|
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 8:52 AM
Points: 469,
Visits: 199
|
|
Great question and coverage on the NOT NULL constraint.
Thanks
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Yesterday @ 8:40 AM
Points: 703,
Visits: 1,032
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Wednesday, October 24, 2012 8:17 PM
Points: 1,588,
Visits: 247
|
|
Nice straightforward question. Thanks for submitting.
http://brittcluff.blogspot.com/
|
|
|
|