Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query optimization

Author  Topic 

msrs

32 Posts

Posted - 2007-11-02 : 05:36:45
Dear all,

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-11-02 : 05:50:34
Well, my first and foremost suggestion is post a well-structured indented code here so that we can know where it starts and where it ends. Its not difficult..just put your code inside [code ][/ code] tags (without space between code and closing bracket).

Secondly, I will suggest to convert all your cases into appropriate JOINS inside the function.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2007-11-02 : 06:17:42
I can agree with harsh on that one, this is more or less impossible to read
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-11-02 : 11:51:35
Check out [url]http://www.sqlinform.com[/url] for a free formatting tool.

As to the performance issue: It's hard to tell since you haven't given us any information other than a query we know nothing about. Can you tell us anything about the table sizes and indexes?

One thing that comes to mind is that you might be able to join to the tables used in your case statements (OATABLE062, OATABLE050, etc). Then use the CASE statement to choose the correct value. It is possible that running all those sub-queries is hurting your performance.(hopefully that makes sense.)

If you can give us some more information we might be able to guide you better.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-09 : 04:46:59
quote:
Originally posted by msrs

Dear all,



Why do you delete all your old questions?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2008-01-09 : 05:03:55
probably there is some issue regarding code posting in her office

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-09 : 05:28:09
Or he realized SQL is not his cup of tee and decided to leave the business?


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -