Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

telerik -- supercharge your DNN websites
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  SQL 2000 && 2005, interesting optimization
Previous Previous
 
Next Next
New Post 6/19/2008 1:38 PM
Informative
User is offline FreeDotNetNuke
156 posts
freedotnetnuke.com
9th Ranked


SQL 2000 && 2005, interesting optimization 

Dear Colleagues!

There is some information about optimization in SQL 2000 and 2005 (may be it can save some time for you in future).

One our client has table with 3 columns: PropertyID INT, PropertyTypeID INT, Details nvarchar

When PropertyTypeID=3, then Details contains decimal number (we know it is not good solution, but it is not our - from another developer).

So task was: get all PropertyID on some conditions. First case for SQL2000 (our dev server) works good:

SELECT *
FROM {databaseOwner}{objectQualifier}Properties
WHERE  (pp.PropertyID IN
  (SELECT PropertyID
  FROM {databaseOwner}{objectQualifier}PropertyDetail
  WHERE 
   (((PropertyTypeID=3) AND (CAST(Details AS decimal(12,2))<=@MaxPrice)) OR (@MaxPrice=-1))
  ))

BUT SQL 2005 causes error "error convert nvarchar to numeric" :( Same code, ok for 2000 and bad for 2005. Have spent additional time and here is another code (with small changes only):

SELECT *
FROM {databaseOwner}{objectQualifier}Properties
(pp.PropertyID IN
  (SELECT PropertyID
  FROM (SELECT * FROM {databaseOwner}{objectQualifier}PropertyDetail WHERE (PropertyTypeID=3)) pd
  WHERE ((CAST(pd.Details AS decimal(12,2))<=@MaxPrice) OR (@MaxPrice=-1)))
  )

You can see query has been changed, so we receive all records with good data to convert and only then verify it with condition.

Hope it will help someone in future.

Sergey


Client always right!
Pages Administration with Drag&Drop for DotNetNuke
List Of All Modules From FreeDotNetNuke
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  SQL 2000 && 2005, interesting optimization
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


OnyakTech
Modules for Help Desks, Live Chat, Project Management, CRM, Charting, Reporting, Scrolling Text/Images, Portal Community tools and much more.
www.OnyakTech.com
IHostASP.NET Provides the Ideal DNN Hosting
We will help you with the installation, configuration, and troubleshooting of your DNN portal, no task is too big or small for us. Unlike other companies we are not just providing a reliable hosting service, but we are also focused on providing the best DotNetNuke hosting service on the internet.
www.ihostasp.net
$7.16/mo - Powerful DotNetNuke Hosting
Powerful DotNetNuke Hosting starting at under $8/mo with FREE SQL 2005, FREE Installation and expert support.
www.re-invent.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP