Click here to Skip to main content
15,886,963 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: A database view that affects the underlying data?! Pin
Jeremy Falcon26-Jan-17 8:40
professionalJeremy Falcon26-Jan-17 8:40 
GeneralRe: A database view that affects the underlying data?! Pin
kmoorevs26-Jan-17 10:45
kmoorevs26-Jan-17 10:45 
GeneralRe: A database view that affects the underlying data?! Pin
Jeremy Falcon26-Jan-17 10:49
professionalJeremy Falcon26-Jan-17 10:49 
QuestionRe: A database view that affects the underlying data?! Pin
Eddy Vluggen26-Jan-17 10:54
professionalEddy Vluggen26-Jan-17 10:54 
AnswerRe: A database view that affects the underlying data?! Pin
kmoorevs26-Jan-17 11:21
kmoorevs26-Jan-17 11:21 
GeneralRe: A database view that affects the underlying data?! Pin
PIEBALDconsult26-Jan-17 14:59
mvePIEBALDconsult26-Jan-17 14:59 
GeneralRe: A database view that affects the underlying data?! Pin
Richard Deeming27-Jan-17 2:22
mveRichard Deeming27-Jan-17 2:22 
GeneralRe: A database view that affects the underlying data?! Pin
Jörgen Andersson27-Jan-17 2:50
professionalJörgen Andersson27-Jan-17 2:50 
Richard Deeming wrote:
A view cannot insert, update, or delete any records. It can only select records.

Actually it can under some circumstances

MSDN wrote:
You can modify the data of an underlying base table through a view, as long as the following conditions are true:
Any modifications, including UPDATE, INSERT, and DELETE statements, must reference columns from only one base table.
The columns being modified in the view must directly reference the underlying data in the table columns. The columns cannot be derived in any other way, such as through the following:
An aggregate function: AVG, COUNT, SUM, MIN, MAX, GROUPING, STDEV, STDEVP, VAR, and VARP.
A computation. The column cannot be computed from an expression that uses other columns. Columns that are formed by using the set operators UNION, UNION ALL, CROSSJOIN, EXCEPT, and INTERSECT amount to a computation and are also not updatable.
The columns being modified are not affected by GROUP BY, HAVING, or DISTINCT clauses.
TOP is not used anywhere in the select_statement of the view together with the WITH CHECK OPTION clause.

CREATE VIEW (Transact-SQL) - MSDN[^]

<edit>BTW, most databases support it since it's standardized in SQL-92</edit>
Wrong is evil and must be defeated. - Jeff Ello

GeneralRe: A database view that affects the underlying data?! Pin
Richard Deeming27-Jan-17 2:55
mveRichard Deeming27-Jan-17 2:55 
GeneralRe: A database view that affects the underlying data?! Pin
Jörgen Andersson27-Jan-17 3:00
professionalJörgen Andersson27-Jan-17 3:00 
GeneralRe: A database view that affects the underlying data?! Pin
PIEBALDconsult27-Jan-17 3:02
mvePIEBALDconsult27-Jan-17 3:02 
GeneralRe: A database view that affects the underlying data?! Pin
Jörgen Andersson27-Jan-17 3:09
professionalJörgen Andersson27-Jan-17 3:09 
GeneralRe: A database view that affects the underlying data?! Pin
Richard Deeming27-Jan-17 5:59
mveRichard Deeming27-Jan-17 5:59 
GeneralRe: A database view that affects the underlying data?! Pin
Jörgen Andersson27-Jan-17 6:22
professionalJörgen Andersson27-Jan-17 6:22 
GeneralRe: A database view that affects the underlying data?! Pin
PIEBALDconsult27-Jan-17 3:00
mvePIEBALDconsult27-Jan-17 3:00 
GeneralRe: A database view that affects the underlying data?! Pin
PIEBALDconsult27-Jan-17 2:59
mvePIEBALDconsult27-Jan-17 2:59 
GeneralReturn the correct null Pin
Bernhard Hiller25-Jan-17 22:55
Bernhard Hiller25-Jan-17 22:55 
GeneralRe: Return the correct null Pin
User 1013254625-Jan-17 23:14
User 1013254625-Jan-17 23:14 
GeneralRe: Return the correct null Pin
Sander Rossel26-Jan-17 1:40
professionalSander Rossel26-Jan-17 1:40 
GeneralRe: Return the correct null Pin
User 1013254626-Jan-17 2:18
User 1013254626-Jan-17 2:18 
GeneralRe: Return the correct null Pin
Richard Deeming26-Jan-17 1:48
mveRichard Deeming26-Jan-17 1:48 
GeneralRe: Return the correct null Pin
Lutosław25-Jan-17 23:24
Lutosław25-Jan-17 23:24 
GeneralRe: Return the correct null Pin
KarstenK26-Jan-17 0:32
mveKarstenK26-Jan-17 0:32 
GeneralRe: Return the correct null Pin
F-ES Sitecore26-Jan-17 0:58
professionalF-ES Sitecore26-Jan-17 0:58 
GeneralRe: Return the correct null Pin
Richard Deeming26-Jan-17 1:59
mveRichard Deeming26-Jan-17 1:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.