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

KB13709: Type mismatch errors are returned from the database in Query Builder reports with attribute element prompts in MicroStrategy Developer 9.x


Stefan Zepeda

Salesforce Solutions Architect • Strategy


Type mismatch errors are returned from the database in Query Builder reports with attribute element prompts in MicroStrategy Developer 9.x

SYMPTOM:
A user executes a Query Builder report, answering prompts contained in the filter, and receives an error like the following in Strategy Developer 9.x upon submitting the job to the database:
 

ka02R000000kX5uQAE_0EM440000002FXE.gif

 
Report: Quarter Datatype
Job: 271
Status: Execution failed
Error: SQL Generation Complete
QueryEngine encountered error: Execute Query failed. Error type: Odbc error. Odbc operation attempted: SQLExecDirect. Syntax error converting the nvarchar value '2003 Q1' to a column of data type int. Error in Process method of Component: QueryEngineServer, Project Strategy Tutorial 8.0, Job 271, Error Code= -2147212544.
NOTE: This error was produced when executing a report against Microsoft SQL Server. The message text will vary depending on the database platform.
 
The report is constructed with an element prompt, as shown below:
 

ka02R000000kX5uQAE_0EM440000002FXK.gif

 
CAUSE:
In the report SQL, the Quarter attribute's description column is being compared to numeric Quarter Ids, as shown below:.
 
select   pa1.QUARTER_ID WJXBFS0,
   pa1.QUARTER_DESC WJXBFS1,
   sum(pa0.TOT_UNIT_SALES) Column1
from   QTR_CATEGORY_SLS pa0
   join LU_QUARTER pa1
      on (pa0.QUARTER_ID = pa1.QUARTER_ID)
where   pa1.QUARTER_DESC in (20041, 20042, 20043, 20044)
group by   pa1.QUARTER_ID,
   pa1.QUARTER_DESC
By design, attribute element prompts insert element IDs into the SQL statement. For the query to execute correctly, the quarter element prompt in this report must be applied to the QUARTER_ID column.
 
While attribute element prompts are likely the most common scenario for this kind of data type mismatch, the same error may occur whenever mixing data types in a Query Builder filter. For this reason, Strategy Developer presents the following warning to the user if the type of the column in a qualification does not match the type of the comparison expression:
 

ka02R000000kX5uQAE_0EM440000002FXG.gif

 
Data type may not be compatible, do you wish to continue?
This is left as an option to the user because the warehouse data may support implicit type conversion within the database, in which case the query may be successful even though the data types do not match exactly.
 
ACTION:
Ensure that the data types are compatible throughout the filter qualification expression. In this case, changing the column from QUARTER_DESC to QUARTER_ID produces a successful query.
 


Comment

0 comments

Details

Knowledge Article

Published:

April 10, 2017

Last Updated:

April 10, 2017