question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sql procedure output value been truncated

See original GitHub issue

Driver version

7.0.0.jre8

SQL Server version

Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright © 2017 Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)

Client Operating System

windows server 2016 datacenter

JAVA/JVM version

openjdk version “1.8.0_191”

Table schema

not table it is procedure

Problem description

procedure

ALTER PROCEDURE [dbo].[PROC_queryPlanReport] 
    @userId bigint,
	@pageNo int,
	@length int,
	@param varchar(255),
    @report varchar(max) output
AS
.....

when i run

declare @param varchar(max), @report varchar(max);
set @param='{"template_name":"xxxxxxx","plan_id":460}'; 
exec PROC_queryPlanReport 178,0,0, @param, @report output;
select @report;

select len(@report)

the len value is 7792 image

but when i call this procedure in java the @report length is 7750 image

why has this difference

and my commection string is jdbc:sqlserver://47.244.60.83:1433;databaseName=wdb;sendStringParametersAsUnicode=false

i already add sendStringParametersAsUnicode=false

thanks for your reply

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
youngeriercommented, Nov 24, 2018

glad for you help . I resolve this problem you may close this issue 😃

1reaction
youngeriercommented, Nov 23, 2018

it’s very nice for your help . but I need automap sql result to java object .so I need use SimpleJdbcCall .finally I try cast varchar(max) to text at the end of the procedure then got full text. Thanks for your help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return strings from SQL Server stored procedures being ...
But the strings passed back from the stored procedures are being truncated to 4000 characters. How do I keep truncation from happening? Details: ......
Read more >
sql procedure output value been truncated · Issue #884 - GitHub
I seem to be missing something I'm not getting the correct results as you on SSMS. To create the stored procedure successfully I...
Read more >
String returned to Output Parameter from Stored Procedure is ...
I'm running a stored procedure which is returning a value. ... value was greater than this default value, hence the truncation error.
Read more >
Output parameter value from stored procedure is truncated
Stored procedure output parameter is VARCHAR(MAX) and the data is truncated to either 4000 or 8000 characters with the JDB…
Read more >
Silent Data truncation in SQL Server 2019 - SQLShack
As we can see above, SQL truncate error occurred due to the length of the data more than the length of the string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found