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  |  

PortalWebHosting
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
 


  Sponsors  

Meet Our Sponsors

Click here to go to dev.live.com for Windows Live developer resources
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
 


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
153 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.

 


SINA101
WANT A SPECial sIte iN TAIWAN?
sina101.com
Web Development and Strategy Firm
The Risdall Interactive Agency s websites, strategies, branding, & promotion in digital space.
www.Risdall.net/
Windsor Management Group
Fund Accounting Software for K12 Education.
Infinitevisions.com

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