Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How do you solve T-SQL problems? Expand / Collapse
Author
Message
Posted Monday, May 20, 2013 10:55 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 4:16 PM
Points: 31,284, Visits: 15,748
Comments posted to this topic are about the item How do you solve T-SQL problems?






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1454812
Posted Tuesday, May 21, 2013 6:25 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, November 7, 2014 11:19 PM
Points: 428, Visits: 993
"Moving forward she asked for help, which is perfectly acceptable way of working in your career. Try to solve it yourself, get a solution working, and then ask if it can be improved. Not only did she end up with a better performing solution, but she learned a bit more along the way. Something we all can do."

The above extract (with the emphasis added by me) is, to me, the most important part of Steve's editorial. While I believe most who participate on this site do ask for help, it often amazes me how many never do, and then wonder why others feel they write and get away with such sucky code.

I always tell people that the only stupid question is the one you don't ask. I try to work that both ways; I try not to be afraid to ask for help and I tell myself when I get what I think is a trivial question that once I didn't know that answer, either.
Post #1454964
Posted Tuesday, May 21, 2013 4:41 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 3:33 PM
Points: 195, Visits: 1,219
To me this is an very interesting editorial and I'm a bit shocked that there aren't about five pages of comments by now instead of a single (and thoughtful) post.

Maybe Americans are getting started on Memorial Day already but that isn't any excuse for the rest of the world. I'd love to hear what you have to say on the subject (and don't we all love to talk about what we think we're good at?).

My two bits:
It begins with problem definition. Johnism: "Undefined problems are unresolved problems". If you can't articulate the issue you are not going to resolve it.

Having a handle on the problem, my next move is to delineate the steps between where I am and where I need to be (the "strategic gap"). Sometimes I do this mentally and sometimes I write them down. Also, I will usually have a good idea at this point if I am going to need help or not.

One very simple thing I usually do before writing a single query is to write a single comment describing what I want that particular query to accomplish. It provides focus for me and a pointer for someone who might follow me someday.

Lastly, I look for opportunities to utilize the techniques you wonderful folks share with the rest of us on a daily basis. I still can't stand in the same room as the very best of you but because of you, I am twice the programmer I was before I started frequenting SSC.
Post #1455255
Posted Wednesday, May 22, 2013 6:03 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:22 AM
Points: 5,757, Visits: 3,677
I think that the first version should be a simple (as per Einstein's definition) set based query that resolves the business question. Of course, this assumes that it is a suitable piece of functionality for this approach. After that you have the basis to perform optimisations as appropriate. It is then worth commenting why optimisations were applied as the optimisations for one SQL Server release may not apply to another etc.

Gaz

-- Stop your grinnin' and drop your linen...they're everywhere!!!
Post #1455443
Posted Wednesday, May 22, 2013 6:33 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, October 31, 2014 6:31 AM
Points: 107, Visits: 514
declare @i int,@done bit
select @i = 0, @done = false
while i<10
begin
try something
observe effects
modify approach
if works then
begin
set @done = 1
end
end
if not @done
seek help

Post #1455452
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse