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

KB484271: When parameters exceed the allowed max length after enabling Parameterized Query, the “String data, right truncated” error is received


Yuwei Yang

Quality Engineer, Senior • MicroStrategy


This article addresses the expected behavior that occurs when parameters exceeds the allowed max length after enabling Parameterized Query for Diamond Gateways.

Description 


After enabling Parameterized Query, there’s a stricter control for column length from certain drivers. You may observe "truncated” errors when parameters exceed the max defined column length.

Steps to reproduce


For example, suppose we have a table 'county' with the following DDL in the SQL Server:

create table country (country_name char(10));

 
If you want to filter a row with country_name as “itsareallylongcountryname," a standard SQL statement is generated when Parameterized Query mode is OFF:
select country_name from country where country_name = ‘itsareallylongcountryname’;

 
The value ‘itsareallylongcountryname’ exceeds the max length allowed for column ‘country_name’ (10). This standard statement will be executed without error and returns 0 row.
Then if Parameterized Query is turned ON:

ka04W000000XP7fQAG_0EM2R000000fdGX.jpeg

A prepared SQL statement is generated as below:

select country_name from country where country_name = ?;with parameters:itsareallylongcountryname

 
 
The SQL Server ODBC driver will raise the error message:
String data, right truncated. Error in parameter 1.

ka04W000000XP7fQAG_0EM2R000000fdGc.jpeg

Why is this happening?


It is an expected behavior on the driver side as the parameter exceeds the max length. The behavior varies from different gateways and connection types.
The following table outlines the expected behavior for Diamond Gateways against JDBC/ODBC connections.

ka04W000000XP7fQAG_0EM2R000000fdGh.jpeg

Since the behavior may be relevant to the driver, the following table outlines the driver version that are certified for this article:

ka04W000000XP7fQAG_0EM2R000000fdGm.jpeg

 


Comment

0 comments

Details

Knowledge Article

Published:

May 19, 2020

Last Updated:

December 20, 2020