Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

VIEWS 6 Expand / Collapse
Author
Message
Posted Tuesday, April 10, 2012 7:25 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, October 13, 2014 2:35 PM
Points: 985, Visits: 1,828
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.
Post #1280774
Posted Tuesday, April 10, 2012 7:47 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:23 PM
Points: 13,082, Visits: 12,542
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
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1280798
Posted Tuesday, April 10, 2012 8:24 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 11:12 AM
Points: 7,791, Visits: 9,545
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
Post #1280826
Posted Tuesday, April 10, 2012 8:53 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, October 16, 2014 4:52 PM
Points: 3,780, Visits: 1,195
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

To better understand your help request, please follow these best practices.
Post #1280849
Posted Tuesday, April 10, 2012 9:42 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:53 AM
Points: 1,176, Visits: 778
great question. cheers Ron!
Post #1280903
Posted Tuesday, April 10, 2012 11:03 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 12:55 PM
Points: 17,811, Visits: 15,732
Thanks Ron.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Post #1280973
Posted Tuesday, April 10, 2012 1:13 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, September 25, 2013 6:23 AM
Points: 392, Visits: 405
That was easy

==================
Database Best Practices


===========================================
Better try and fail than not to try at all...

Database Best Practices

SQL Server Best Practices
Post #1281087
Posted Wednesday, April 11, 2012 8:10 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, July 30, 2014 10:52 PM
Points: 483, Visits: 244
Great question and coverage on the NOT NULL constraint.

Thanks
Post #1281559
Posted Thursday, April 12, 2012 2:21 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 900, Visits: 1,267
Good question thanks.
Post #1282188
Posted Monday, April 23, 2012 8:11 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, April 27, 2014 7:45 PM
Points: 1,589, Visits: 253
Nice straightforward question. Thanks for submitting.

http://brittcluff.blogspot.com/
Post #1288614
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse