Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How do you solve T-SQL problems?


How do you solve T-SQL problems?

Author
Message
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36105 Visits: 18739
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
My Blog: www.voiceofthedba.com
Bob Razumich
Bob Razumich
Mr or Mrs. 500
Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)Mr or Mrs. 500 (516 reputation)

Group: General Forum Members
Points: 516 Visits: 1152
"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.
jshahan
jshahan
Old Hand
Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)Old Hand (391 reputation)

Group: General Forum Members
Points: 391 Visits: 1995
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.
Gary Varga
Gary Varga
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8325 Visits: 6150
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!!!
lnardozi 61862
lnardozi 61862
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 615

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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search