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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query optimization
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

32 Posts

Posted - 11/02/2007 :  05:36:45  Show Profile  Reply with Quote
Dear all,

Edited by - msrs on 01/09/2008 03:55:17

Flowing Fount of Yak Knowledge

5581 Posts

Posted - 11/02/2007 :  05:50:34  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message  Reply with Quote
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
Go to Top of Page

Aged Yak Warrior

United Kingdom
530 Posts

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

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 11/02/2007 :  11:51:35  Show Profile  Reply with Quote
Check out 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

Premature Yak Congratulator

22864 Posts

Posted - 01/09/2008 :  04:46:59  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Originally posted by msrs

Dear all,

Why do you delete all your old questions?


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

Flowing Fount of Yak Knowledge

1274 Posts

Posted - 01/09/2008 :  05:03:55  Show Profile  Send sunsanvin a Yahoo! Message  Reply with Quote
probably there is some issue regarding code posting in her office

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

Patron Saint of Lost Yaks

30421 Posts

Posted - 01/09/2008 :  05:28:09  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.15 seconds. Powered By: Snitz Forums 2000