Click here to Skip to main content
13,407,586 members (51,594 online)

Welcome to the Lounge


For discussing anything related to a software developer's life. Technical discussions are encouraged, but click here to ask your programming questions.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.
GeneralRe: XCode question Pin
Nish Sivakumar20-Jun-14 6:15
mvpNish Sivakumar20-Jun-14 6:15 
GeneralRe: XCode question Pin
Ian Shlasko20-Jun-14 6:18
memberIan Shlasko20-Jun-14 6:18 
GeneralRe: XCode question Pin
Frank Alviani20-Jun-14 6:49
memberFrank Alviani20-Jun-14 6:49 
GeneralRe: XCode question Pin
PIEBALDconsult20-Jun-14 7:21
memberPIEBALDconsult20-Jun-14 7:21 
GeneralRe: XCode question Pin
Nemanja Trifunovic20-Jun-14 10:24
memberNemanja Trifunovic20-Jun-14 10:24 
GeneralRe: XCode question Pin
Dennis E White20-Jun-14 11:43
memberDennis E White20-Jun-14 11:43 
GeneralRe: XCode question Pin
Dennis E White20-Jun-14 11:48
memberDennis E White20-Jun-14 11:48 
GeneralDiscoveries Pin
John Simmons / outlaw programmer20-Jun-14 5:08
memberJohn Simmons / outlaw programmer20-Jun-14 5:08 
New job, perusing one of the dozens of databases we use on a daily basis. I found:

0) All of the views in at least one of our databases includes this:


Evidently, the first line enables you to trick SqlServer 2008 (and earlier) into allowing the ORDER BY clause in a view. Of course, newer versions of SQL Server ignore both clauses, and IMHO doing ORDER BY in a view is kinda pointless anyway

1) I encountered a view that has 519 OR clauses that evaluate the value of 20 columns. When run in its original form, it took 11 seconds to execute and returns 2900 rows. I modified it to declare a varchar variable and then called CHARINDEX for each column one time, and execution time is now < 1 second.

2) I encountered another view like the one above where execution time was 4 seconds, and using the same technique, I reduced it to < 1 second.

3) Formatting of the SQL I've seen so far is, well, abysmal - and that's me being nice .

I consider my SQL skills to be slightly above the beginner level, but jeeze...

EDIT =======================

I'm surprised nobody has yet pointed out that you can't declare local vars in views (ask me how I know). Smile | :)
".45 ACP - because shooting twice is just silly" - JSOP, 2010
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

modified 20-Jun-14 10:55am.

GeneralRe: Discoveries Pin
HomerTheGreat20-Jun-14 5:14
memberHomerTheGreat20-Jun-14 5:14 
GeneralRe: Discoveries Pin
PIEBALDconsult20-Jun-14 5:16
memberPIEBALDconsult20-Jun-14 5:16 
GeneralRe: Discoveries Pin
Pualee20-Jun-14 5:20
memberPualee20-Jun-14 5:20 
GeneralRe: Discoveries Pin
Richard Deeming20-Jun-14 5:32
professionalRichard Deeming20-Jun-14 5:32 
GeneralRe: Discoveries Pin
John Simmons / outlaw programmer20-Jun-14 5:53
memberJohn Simmons / outlaw programmer20-Jun-14 5:53 
GeneralRe: Discoveries Pin
Tim Carmichael20-Jun-14 6:41
memberTim Carmichael20-Jun-14 6:41 
GeneralRe: Discoveries Pin
Dan Neely20-Jun-14 6:41
memberDan Neely20-Jun-14 6:41 
GeneralRe: Discoveries Pin
newton.saber20-Jun-14 6:52
membernewton.saber20-Jun-14 6:52 
GeneralRe: Discoveries Pin
Sander Rossel20-Jun-14 8:40
professionalSander Rossel20-Jun-14 8:40 
GeneralI didn't realize this law was necessary Pin
Kschuler20-Jun-14 4:44
memberKschuler20-Jun-14 4:44 
GeneralRe: I didn't realize this law was necessary Pin
OriginalGriff20-Jun-14 5:11
protectorOriginalGriff20-Jun-14 5:11 
GeneralRe: I didn't realize this law was necessary Pin
Pualee20-Jun-14 5:23
memberPualee20-Jun-14 5:23 
GeneralRe: I didn't realize this law was necessary Pin
PapaCraft20-Jun-14 5:38
memberPapaCraft20-Jun-14 5:38 
GeneralRe: I didn't realize this law was necessary Pin
deflinek20-Jun-14 7:46
memberdeflinek20-Jun-14 7:46 
GeneralRe: I didn't realize this law was necessary Pin
Bergholt Stuttley Johnson20-Jun-14 5:55
memberBergholt Stuttley Johnson20-Jun-14 5:55 
GeneralRe: I didn't realize this law was necessary Pin
Maarten Kools20-Jun-14 6:14
professionalMaarten Kools20-Jun-14 6:14 
GeneralRe: I didn't realize this law was necessary Pin
Ian Shlasko20-Jun-14 6:14
memberIan Shlasko20-Jun-14 6:14 

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.

Advertise | Privacy |
Web02-2016 | 2.8.180212.1 | Last Updated 23 Feb 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid