All Forums Database
Lee 6 posts Joined 03/05
04 May 2016
CAST Varchar

This is a cross posting from a question in the Connectivity forum as I am not sure where the resolution fits - apologies if inappropriate:
We are having in issue in that a WebFocus report cannot read a view and we have narrowed it down to the columns below..
My question is there is anything in the CAST statement that can declare the result as ANSI, I did see one reference on here to an ANSI explicit CAST but am struggling to find.
All advice gratefully received! Thank you
,cast(case
when  SD1.EDWSS46_DLR_C
  is not null
  then  SD1.EDWSS44_DLR_DSTRCT_N
  else null
  end as Varchar(80)) as EDWSS44_DLR_DSTRCT_N
,Cast(case
when   SD1.EDWSS46_DLR_C
  is not null
  then SD1.EDWSS45_DLR_ZONE_D
  else null
  end as char(2)) as EDWSS45_DLR_ZONE_C
,cast(case
when  SD1.EDWSS46_DLR_C
  is not null
  then SD1.EDWSS45_DLR_ZONE_N
  else null
  end as varchar(80))  as EDWSS45_DLR_ZONE_N
 
 

Lee
ToddAWalter 316 posts Joined 10/11
04 May 2016

CAST is an ANSI construct.
What error are you getting from the tool? Have you talked to WebFocus about the error?

Lee 6 posts Joined 03/05
04 May 2016

Ahha - thank you
Yes, the problem I have is that the WF team are pointing at the code on the view and I think it's in the connection set up (from reviewing other posts)
We are getting error 3996 Truncation of right string..
This answer will help me push the question, thank you :-)
 

Lee

Fred 1096 posts Joined 08/04
06 May 2016

In Teradata mode, string right truncation is ignored. But in ANSI mode, you get 3996 error if a non-blank character is truncated.
Eliminate the error either by increasing the length for the CAST or using SUBSTRING inside the CAST (if you intend to truncate the long values). Then the SQL will work in both ANSI and Teradata mode.

Lee 6 posts Joined 03/05
08 May 2016

Thank you!
 
The interesting thing I learn was what works in Teradata directly gets in a twist with WF SQL Passthru - good to learn!

Lee

You must sign in to leave a comment.