Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


VIEWS 6


VIEWS 6

Author
Message
jeff.mason
jeff.mason
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1153 Visits: 2126
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.
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16572 Visits: 17018
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)
TomThomson
TomThomson
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10709 Visits: 12008
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

EL Jerry
EL Jerry
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3914 Visits: 1337
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.
OzYbOi d(-_-)b
OzYbOi d(-_-)b
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1300 Visits: 778
great question. cheers Ron!
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21075 Visits: 18259
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

BuntyBoy
BuntyBoy
SSC-Addicted
SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)SSC-Addicted (408 reputation)

Group: General Forum Members
Points: 408 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
zymos
zymos
Mr or Mrs. 500
Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)Mr or Mrs. 500 (540 reputation)

Group: General Forum Members
Points: 540 Visits: 259
Great question and coverage on the NOT NULL constraint.

Thanks
skanker
skanker
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1019 Visits: 1385
Good question thanks.
Britt Cluff
Britt Cluff
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1693 Visits: 253
Nice straightforward question. Thanks for submitting.

http://brittcluff.blogspot.com/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search