135 reputation
16
bio website
location
age
visits member for 2 years, 5 months
seen Sep 11 at 8:34

Oct
13
awarded  Notable Question
Aug
11
awarded  Popular Question
Jun
10
comment Why is one of these queries orders of magnitude slower than the other?
I'm only using TOP 1 to see what happens - as it happens, when I use TOP 1 throughout (and an ORDER BY on the innermost query - my fault, bad edit), the query returns. If I use TOP 2, it stops working again. The reason I'm not using JOINs is twofold. The first is that I'm more comfortable doing it this way (my SSMS window currently has the first query, copy-pasted into the second query, copy-pasted into the third query, etc). The second is that I had similar performance issues with JOINS and wasn't seeing those issues - right up until this point.
Jun
10
revised Why is one of these queries orders of magnitude slower than the other?
Added TOP 1 vs TOP 2 comparison
Jun
10
comment Why is one of these queries orders of magnitude slower than the other?
704,000 and 213,000 respectively. However, adding the predicate basetype = 60 at the outermost level does nothing. (Or, at least, doesn't nearly match the performance I would expect).
Jun
10
asked Why is one of these queries orders of magnitude slower than the other?
Feb
18
comment How can I dynamically alias columns?
@JonathanVanMatre Absolutely. Fortunately, this is only for internal use, and all the inputs are already sanitized by the app.
Feb
17
revised How can I dynamically alias columns?
added 176 characters in body
Feb
17
comment How can I dynamically alias columns?
Using dynamic SQL is the correct answer, given that the question asked how to do it with SQL. It was also something I'd tried to do, but incorrectly.
Feb
17
accepted How can I dynamically alias columns?
Feb
17
comment How can I dynamically alias columns?
@DenisT It turns out that my subqueries used to build the dynamic SQL were incorrect and returned null sets. So SQL Server returned a blank query, which it duly executed successfully. Thanks for pointing out the PRINT command.
Feb
17
comment How can I dynamically alias columns?
I agree, and I could definitely do this in SSRS, but I can't do it in the other reporting software I'm using at the moment.
Feb
17
comment How can I dynamically alias columns?
@JonofAllTrades Unfortunately, while they are fairly stable, it's very much part of the spec that when the user changes something in the software, that thing must also change in the reports.
Feb
17
comment How can I dynamically alias columns?
@DenisT, It doesn't output anything, which perhaps indicates something else is wrong as well. Thanks for the lead.
Feb
17
asked How can I dynamically alias columns?
Sep
21
awarded  Supporter
Sep
21
comment How do I monitor which Windows user is logging in as SA?
Hadn't thought about the PID! Good idea.
Sep
20
comment How do I monitor which Windows user is logging in as SA?
I asked very nicely if I could create a series of log-ins (one for each application - which use XML configs to store their username and passwords). The IT based administration were very happy for me to do this, and on their recommendation, the person I report to just kind of shrugged and said ok. Everything turned out better than expected.
Sep
20
comment How do I monitor which Windows user is logging in as SA?
Well, they would. The part I'm worried about are the pitchforks and torches they would bring with them as they beat the path to my door. For the record, I've just asked if I'm allowed (woo! complex intercompany administration red-tape!) to add individual SQL logins. Also, this issue makes me feel jaded and sarcastic for some reason.
Sep
20
awarded  Commentator