Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsMax size for SQL statement?Max size for SQL statement?
Previous
 
Next
New Post
7/3/2007 7:58 PM
 

I'm trying to use the report module, and when I run the Test Query option it tells me Test Successful, n records returned.  However as soon as I hit Update the page tells me There is an error in your SQL Query on line X.  When I go back in to look at it the bottom part has been cut off.  The following query is what I'm trying to run:

 


 

declare @cname nvarchar(50)
set @cname = 'TestTest
declare @cpid int
set @cpid = (select PropertyDefinitionID from dnn_ProfilePropertyDefinition where PropertyName='Company')
declare @cid int
set @cid = (select CompanyID from sn_Companies where CompanyName = @cname)

DECLARE @enddate datetime, @startdate datetime
SET @enddate = CAST(FLOOR(CAST(GETDATE() - 1 AS float)) AS datetime)
IF DATEPART(day, @enddate) > 15
    SET @startdate = DATEADD(day, -DATEPART(day, @enddate)+16, @enddate)
ELSE
    SET @startdate = DATEADD(day, -DATEPART(day, @enddate)+1, @enddate)

SELECT
--    DISTINCT
    PROJECTS.ProjectName,
    ISSUES.IssueId,
    ISSUES.IssueTitle,
    USERS.DisplayName,
    ISSUES.DateCreated,
    CATEGORIES.CategoryName,
    PRIORITIES.PriorityName,
    STATUS.StatusName,
--    COMMENTS.Hours,
    CSR.Multiplier * PSR.Multiplier Multiplier,
    SUM(COMMENTS.Hours) Hours,
    COMPANIES.Rate Rate,
    CSR.Multiplier * PSR.Multiplier * SUM(Comments.Hours) * COMPANIES.Rate TicketCharge
FROM
    dnn_ONYAK_SIGMAPRO_Projects PROJECTS,
    dnn_ONYAK_SIGMAPRO_Issues ISSUES,
    dnn_ONYAK_SIGMAPRO_IssueComments COMMENTS,
    dnn_ONYAK_SIGMAPRO_ProjectCategories CATEGORIES
        JOIN sn_CategoryServiceRates CSR ON    CATEGORIES.CategoryID = CSR.CategoryID,
    dnn_ONYAK_SIGMAPRO_ProjectPriorities PRIORITIES
        JOIN sn_PriorityServiceRates PSR ON    PRIORITIES.PriorityID = PSR.PriorityID,
    dnn_ONYAK_SIGMAPRO_ProjectStatus STATUS,
    dnn_Users USERS,
--    sn_CategoryServiceRates CSR,
--    sn_PriorityServiceRates PSR,
    sn_Companies COMPANIES,
    (SELECT UserID FROM dnn_UserProfile    WHERE PropertyDefinitionID = @cpid AND PropertyValue = @cname) COMPANYUSERIDS
WHERE
    ISSUES.ProjectID = PROJECTS.ProjectId AND
    ISSUES.RequesterID = COMPANYUSERIDS.UserID AND
    COMMENTS.DateCreated <= @enddate AND
    COMMENTS.DateCreated >= @startdate AND
    ISSUES.IssueId = COMMENTS.IssueId AND
    ISSUES.IssueCategoryId = CATEGORIES.CategoryID AND
    ISSUES.IssuePriorityId = PRIORITIES.PriorityId AND
    ISSUES.IssueStatusId = STATUS.StatusID AND
    USERS.UserID = ISSUES.RequesterID AND
--    ISSUES.IssuePriorityId = PSR.PriorityID    AND
--    ISSUES.IssueCategoryId = CSR.CategoryID    AND
    COMPANIES.CompanyID = @cid
GROUP BY
    PROJECTS.ProjectName,
    ISSUES.IssueId,
    ISSUES.IssueTitle,
    USERS.DisplayName,
    ISSUES.DateCreated,
    CATEGORIES.CategoryName,
    PRIORITIES.PriorityName,
    STATUS.StatusName,
--    COMMENTS.Hours,
--    COMMENTS.CommentId,
    CSR.Multiplier,
    PSR.Multiplier,
    COMPANIES.Rate


 

And this is what remains after hitting Update:


 

declare @cname nvarchar(50)
set @cname = 'TestTest'
declare @cpid int
set @cpid = (select PropertyDefinitionID from dnn_ProfilePropertyDefinition where PropertyName='Company')
declare @cid int
set @cid = (select CompanyID from sn_Companies where CompanyName = @cname)

DECLARE @enddate datetime, @startdate datetime
SET @enddate = CAST(FLOOR(CAST(GETDATE() - 1 AS float)) AS datetime)
IF DATEPART(day, @enddate) > 15
    SET @startdate = DATEADD(day, -DATEPART(day, @enddate)+16, @enddate)
ELSE
    SET @startdate = DATEADD(day, -DATEPART(day, @enddate)+1, @enddate)

SELECT
--    DISTINCT
    PROJECTS.ProjectName,
    ISSUES.IssueId,
    ISSUES.IssueTitle,
    USERS.DisplayName,
    ISSUES.DateCreated,
    CATEGORIES.CategoryName,
    PRIORITIES.PriorityName,
    STATUS.StatusName,
--    COMMENTS.Hours,
    CSR.Multiplier * PSR.Multiplier Multiplier,
    SUM(COMMENTS.Hours) Hours,
    COMPANIES.Rate Rate,
    CSR.Multiplier * PSR.Multiplier * SUM(Comments.Hours) * COMPANIES.Rate TicketCharge
FROM
    dnn_ONYAK_SIGMAPRO_Projects PROJECTS,
    dnn_ONYAK_SIGMAPRO_Issues ISSUES,
    dnn_ONYAK_SIGMAPRO_IssueComments COMMENTS,
    dnn_ONYAK_SIGMAPRO_ProjectCategories CATEGORIES
        JOIN sn_CategoryServiceRates CSR ON    CATEGORIES.CategoryID = CSR.CategoryID,
    dnn_ONYAK_SIGMAPRO_ProjectPriorities PRIORITIES
        JOIN sn_PriorityServiceRates PSR ON    PRIORITIES.PriorityID = PSR.PriorityID,
    dnn_ONYAK_SIGMAPRO_ProjectStatus STATUS,
    dnn_Users USERS,
--    sn_CategoryServiceRates CSR,
--    sn_PriorityServiceRates PSR,
    sn_Companies COMPANIES,
    (SELECT UserID FROM dnn_UserProfile    WHERE PropertyDefinitionID = @cpid AND PropertyValue = @cname) COMPANYUSERIDS
WHERE
    ISSUES.ProjectID = PROJECTS.ProjectId AND
    ISSUES.RequesterID = COMPANYUSERIDS.UserID AND
    COMMENTS.DateCreated <= @enddate AND
    COMMENTS.DateCreated >= @startdate AND
    ISSUES.IssueId = COMMENTS.IssueId AND
    ISSUES.IssueCategoryId = CATEGORIES.CategoryID AND
    ISSUES.IssuePriorityId = PRIORITIES.PriorityId AND
    ISSUES.IssueStatusId = STATUS.

 


What's going on?  Is there a character limit on the query?  If so, what is it?  And ideally, can it be removed?

 
New Post
7/19/2007 9:54 AM
 

I've run into the same issue. Any resolution? I've looked through the database for a field to increase and haven't been able to find it. Let me know if you've found anything out.

Thanks

 
New Post
7/19/2007 11:25 AM
 

The Reports module saves all queries in the "modulesettings" table.

You can find the query by item id, and the setting name of "dnn_reports_query"

This table has a 2000 character cap for the SettingValue

I am not sure if you could simply do an alter table statement to up the size limit or if it is sized elsewhere in the core as well.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
7/19/2007 1:47 PM
 

As a possible alternative...

<sameless plug>

SQLGridSelectedView will allow SQL Queries upto at least 8000 characters.  The Select statement is zipped when stored in the ModulesSettings table to address the 2000 character limitation.  SQLGridSelectedView is available at www.tressleworks.ca  

</sameless plug>

Hope this helps,
Paul.

 
New Post
7/19/2007 6:07 PM
 

Not shameless Paul,

It's a great flexible module for displaying/editing/creating data. Certainly not as powerful as something like ListX, but ListX has a huge learning curve.



 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsMax size for SQL statement?Max size for SQL statement?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out