Click here to Skip to main content
11,707,470 members (75,638 online)

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy except programming questions.

Technical discussions are encouraged, but click here to ask your programming question.

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: Admit it NOW Pin
S Houghtelin20-Jun-14 6:41
professionalS Houghtelin20-Jun-14 6:41 
GeneralRe: Admit it NOW Pin
HomerTheGreat20-Jun-14 7:44
memberHomerTheGreat20-Jun-14 7:44 
AnswerRe: Admit it NOW Pin
Dan Colasanti20-Jun-14 8:05
professionalDan Colasanti20-Jun-14 8:05 
JokeRe: Admit it NOW Pin
jeron120-Jun-14 8:31
memberjeron120-Jun-14 8:31 
GeneralXCode question Pin
MikeGledhill20-Jun-14 4:45
memberMikeGledhill20-Jun-14 4:45 
GeneralRe: XCode question Pin
d@nish 20-Jun-14 4:54
member d@nish 20-Jun-14 4:54 
GeneralRe: XCode question Pin
Nish Sivakumar20-Jun-14 5:15
mvpNish Sivakumar20-Jun-14 5:15 
GeneralRe: XCode question Pin
Ian Shlasko20-Jun-14 5:18
memberIan Shlasko20-Jun-14 5:18 
GeneralRe: XCode question Pin
Frank Alviani20-Jun-14 5:49
memberFrank Alviani20-Jun-14 5:49 
GeneralRe: XCode question Pin
PIEBALDconsult20-Jun-14 6:21
memberPIEBALDconsult20-Jun-14 6:21 
GeneralRe: XCode question Pin
Nemanja Trifunovic20-Jun-14 9:24
memberNemanja Trifunovic20-Jun-14 9:24 
GeneralRe: XCode question Pin
Dennis E White20-Jun-14 10:43
memberDennis E White20-Jun-14 10:43 
GeneralRe: XCode question Pin
Dennis E White20-Jun-14 10:48
memberDennis E White20-Jun-14 10:48 
GeneralDiscoveries Pin
John Simmons / outlaw programmer20-Jun-14 4:08
memberJohn Simmons / outlaw programmer20-Jun-14 4: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:

SELECT TOP(100) PERCENT
...
ORDER BY...

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). :)
".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 4:14
memberHomerTheGreat20-Jun-14 4:14 
GeneralRe: Discoveries Pin
PIEBALDconsult20-Jun-14 4:16
memberPIEBALDconsult20-Jun-14 4:16 
GeneralRe: Discoveries Pin
Pualee20-Jun-14 4:20
memberPualee20-Jun-14 4:20 
GeneralRe: Discoveries Pin
Richard Deeming20-Jun-14 4:32
professionalRichard Deeming20-Jun-14 4:32 
GeneralRe: Discoveries Pin
John Simmons / outlaw programmer20-Jun-14 4:53
memberJohn Simmons / outlaw programmer20-Jun-14 4:53 
GeneralRe: Discoveries Pin
Tim Carmichael20-Jun-14 5:41
memberTim Carmichael20-Jun-14 5:41 
GeneralRe: Discoveries Pin
Dan Neely20-Jun-14 5:41
memberDan Neely20-Jun-14 5:41 
GeneralRe: Discoveries Pin
newton.saber20-Jun-14 5:52
membernewton.saber20-Jun-14 5:52 
GeneralRe: Discoveries Pin
Sander Rossel20-Jun-14 7:40
professionalSander Rossel20-Jun-14 7:40 
GeneralI didn't realize this law was necessary Pin
Kschuler20-Jun-14 3:44
memberKschuler20-Jun-14 3:44 
GeneralRe: I didn't realize this law was necessary Pin
OriginalGriff20-Jun-14 4:11
protectorOriginalGriff20-Jun-14 4:11 
GeneralRe: I didn't realize this law was necessary Pin
Pualee20-Jun-14 4:23
memberPualee20-Jun-14 4:23 
GeneralRe: I didn't realize this law was necessary Pin
PapaCraft20-Jun-14 4:38
memberPapaCraft20-Jun-14 4:38 
GeneralRe: I didn't realize this law was necessary Pin
deflinek20-Jun-14 6:46
memberdeflinek20-Jun-14 6:46 
GeneralRe: I didn't realize this law was necessary Pin
Bergholt Stuttley Johnson20-Jun-14 4:55
memberBergholt Stuttley Johnson20-Jun-14 4:55 
GeneralRe: I didn't realize this law was necessary Pin
Maarten Kools20-Jun-14 5:14
professionalMaarten Kools20-Jun-14 5:14 
GeneralRe: I didn't realize this law was necessary Pin
Ian Shlasko20-Jun-14 5:14
memberIan Shlasko20-Jun-14 5:14 
GeneralRe: I didn't realize this law was necessary Pin
JimmyRopes20-Jun-14 6:17
memberJimmyRopes20-Jun-14 6:17 
GeneralRe: I didn't realize this law was necessary Pin
bling20-Jun-14 6:25
memberbling20-Jun-14 6:25 
GeneralRe: I didn't realize this law was necessary Pin
PIEBALDconsult20-Jun-14 7:49
memberPIEBALDconsult20-Jun-14 7:49 
GeneralRe: I didn't realize this law was necessary Pin
Ian Shlasko20-Jun-14 8:17
memberIan Shlasko20-Jun-14 8:17 
GeneralRe: I didn't realize this law was necessary Pin
OriginalGriff20-Jun-14 8:44
protectorOriginalGriff20-Jun-14 8:44 
GeneralRe: I didn't realize this law was necessary Pin
PIEBALDconsult20-Jun-14 14:13
memberPIEBALDconsult20-Jun-14 14:13 
GeneralRe: I didn't realize this law was necessary Pin
JimmyRopes20-Jun-14 18:18
memberJimmyRopes20-Jun-14 18:18 
GeneralRe: I didn't realize this law was necessary Pin
HomerTheGreat20-Jun-14 9:33
memberHomerTheGreat20-Jun-14 9:33 
JokeRe: I didn't realize this law was necessary Pin
PapaCraft20-Jun-14 12:58
memberPapaCraft20-Jun-14 12:58 
GeneralWell, I have one question today... Pin
glennPattonWork20-Jun-14 3:42
professionalglennPattonWork20-Jun-14 3:42 
GeneralRe: Well, I have one question today... Pin
WiganLatics20-Jun-14 3:48
memberWiganLatics20-Jun-14 3:48 
GeneralRe: Well, I have one question today... Pin
glennPattonWork20-Jun-14 4:01
professionalglennPattonWork20-Jun-14 4:01 
GeneralRe: Well, I have one question today... Pin
OriginalGriff20-Jun-14 4:07
protectorOriginalGriff20-Jun-14 4:07 
GeneralRe: Well, I have one question today... Pin
WiganLatics20-Jun-14 4:15
memberWiganLatics20-Jun-14 4:15 
GeneralHappy Birthday, Nish! Pin
Roger Wright20-Jun-14 3:37
memberRoger Wright20-Jun-14 3:37 
GeneralRe: Happy Birthday, Nish! Pin
Dinesh.V.Kumar20-Jun-14 3:41
memberDinesh.V.Kumar20-Jun-14 3:41 
GeneralRe: Happy Birthday, Nish! Pin
Nish Sivakumar20-Jun-14 3:52
mvpNish Sivakumar20-Jun-14 3:52 
GeneralRe: Happy Birthday, Nish! Pin
Marco Bertschi20-Jun-14 4:28
protectorMarco Bertschi20-Jun-14 4:28 
GeneralRe: Happy Birthday, Nish! Pin
Nish Sivakumar20-Jun-14 4:28
mvpNish Sivakumar20-Jun-14 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web03 | 2.8.150819.1 | Last Updated 31 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid