EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB32895: A Freeform SQL report accessing a Microsoft SQL Server stored procedure returns different results when executed in a two-tier connection compared to a three-tier connection in MicroStrategy Engine 9.x


Stefan Zepeda

Salesforce Solutions Architect • Strategy


SYMPTOM
A Freeform SQL report is created in Strategy Developer and 9.x, to retrieve data from a stored procedure in Microsoft SQL Server. The Freeform SQL definition uses SQL Server syntax to execute the stored procedure:
 
EXEC
 
The procedure's output columns are mapped onto Strategy attribute forms and metrics, in the usual way for Freeform SQL reports.
 

ka02R000000kc4OQAQ_0EM440000002E8D.gif

 
When the Freeform SQL report is executed in a two-tier connection, the results are the same as running the EXEC statement directly against the warehouse, using the Strategy DB Query Tool or Microsoft SQL Server Management Studio. In a three-tier connection, however, the results are different.
 


Browse:GrantRead:GrantWrite:DenyDelete:DenyControl:DenyUse:GrantExecute:GrantData VolumeProgress ODBC DriverProgress JDBC DriverNative ODBC Driver3,948,159 rows and 43 columns44.46s57.06s57sPropertyFilter AFilter BDateTime#6/29/2001##6/29/2001#Day2929DayOfWeekDssDayFridayDssDaySundayDynamicDayOffset<Application Defined>0DynamicDateDssTimeNotDynamicTimeDssTimeTodayHour00IsGmtFalseFalseMiliSeconds00Minutes00ModeDssDateTimeModeLocaleInsensitiveDssDateTimeModeLocaleInsensitiveMonthDssMonthJuneDssMonthJuneName""""Seconds00Week51Year20012001AdministratorFull ControlEveryoneViewPublic / GuestViewArgumentDescriptionevt4001 - runReport Executes the report specified by either the reportID or reportName argument.srcSpecifies both the page component to handle the action and the event.reportIDSpecifies the ID of the report to execute.reportNameCan be used instead of reportID.reportViewModeGrid (1) or Graph (2) Mode.objectsPromptAnswersSpecifies the ID(s), type(s) and name(s) of the object(s) to answer a prompt, or multiple promptsStrategy DB2 Wire ProtocolIBM DB2 Connect0 - Read UncommittedUncommitted Read1 – Read CommittedCursor Stability2 – Repeatable ReadRead Stability3 – SerializableRepeatable Read4 - NoneNo Commit


Browse:GrantRead:GrantWrite:DenyDelete:DenyControl:DenyUse:GrantExecute:GrantData VolumeProgress ODBC DriverProgress JDBC DriverNative ODBC Driver3,948,159 rows and 43 columns44.46s57.06s57sPropertyFilter AFilter BDateTime#6/29/2001##6/29/2001#Day2929DayOfWeekDssDayFridayDssDaySundayDynamicDayOffset<Application Defined>0DynamicDateDssTimeNotDynamicTimeDssTimeTodayHour00IsGmtFalseFalseMiliSeconds00Minutes00ModeDssDateTimeModeLocaleInsensitiveDssDateTimeModeLocaleInsensitiveMonthDssMonthJuneDssMonthJuneName""""Seconds00Week51Year20012001AdministratorFull ControlEveryoneViewPublic / GuestViewArgumentDescriptionevt4001 - runReport Executes the report specified by either the reportID or reportName argument.srcSpecifies both the page component to handle the action and the event.reportIDSpecifies the ID of the report to execute.reportNameCan be used instead of reportID.reportViewModeGrid (1) or Graph (2) Mode.objectsPromptAnswersSpecifies the ID(s), type(s) and name(s) of the object(s) to answer a prompt, or multiple promptsStrategy DB2 Wire ProtocolIBM DB2 Connect0 - Read UncommittedUncommitted Read1 – Read CommittedCursor Stability2 – Repeatable ReadRead Stability3 – SerializableRepeatable Read4 - NoneNo Commit

  
CAUSE
This behavior occurs because of the application of the Strategy governing setting for the maximum number of report result rows. The governing setting, found in Project Configuration > Governing, is not used during two-tier execution, but it is applied in the Intelligence Server in three-tier or four-tier connections.
 
The Strategy Query Engine applies the row limit governor by setting an ODBC connection parameter, SQL_ATTR_MAX_ROWS. The Microsoft SQL Server ODBC driver handles this parameter by issuing a statement against the database, SET ROWCOUNT n, where n is the value of the governing setting. The row count applies in SQL Server not only to the stored procedure's final results, but also to intermediate query results used within the procedure. If an intermediate result exceeds the row count, Microsoft SQL Server does not fail execution with an error; it simply truncates the intermediate dataset to the specified number of rows.
 
In the above example, the stored procedure creates an intermediate table containing all customer IDs (of which there are 10,000 in the Strategy Tutorial warehouse). The two-tier result includes all 10,000 customers in the final aggregation. In three-tier, the intermediate table is restricted to 1000 customers (by setting the Strategy row limit governor to 1000). Then, the final aggregation covers a subset of the customers, and the metric results are different.
 
Note that the same behavior can be reproduced in Microsoft SQL Server Management Studio by executing "SET ROWCOUNT 1000" before executing the stored procedure. Therefore, the issue is not specific to Strategy.
 
ACTION
The Strategy row limit governor can be disabled in individual reports by using the Results Set Row Limit VLDB property under the Governing category. The default value is -1, which allows the project-level governor to apply. Setting the property to 0 overrides the project-level governor to permit an unlimited number of rows for this report only.
 

ka02R000000kc4OQAQ_0EM440000002E8F.gif

 
After this change, the report will return the same results as in two-tier.
 
It is not necessary to disable row-limit governing globally for the project.
 
Note: This issue might not occur with Strategy Intelligence Server Universal in Linux/UNIX environments. In operating systems other than Microsoft Windows, Strategy ships the SQL Server Wire Protocol driver from DataDirect. This driver handles SQL_ATTR_MAX_ROWS differently from the native Microsoft driver, and may not trigger the behavior in the database.
 
 
 


Comment

0 comments

Details

Knowledge Article

Published:

May 30, 2017

Last Updated:

May 30, 2017