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

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

msrs
Starting Member

India
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

harsh_athalye
Flowing Fount of Yak Knowledge

India
5509 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
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

NeilG
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

Lamprey
Flowing Fount of Yak Knowledge

4608 Posts

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

India
22744 Posts

Posted - 01/09/2008 :  04:46:59  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
1266 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

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

SwePeso
Patron Saint of Lost Yaks

Sweden
30108 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  
 New 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.08 seconds. Powered By: Snitz Forums 2000