Skip to Content
0

Can not CAST GUID16 (VARBINARY) into CHAR32 (NVARCHAR)

Apr 21, 2017 at 10:28 AM

93

avatar image

Hello colleagues,

I know it has been already discussed several times, but i would like to get some support or maybe guidance, how can i continue my investigations.

I would like to convert GUID into CHAR32 as is without any decoding.

During my tests, i wrote an AMDP method where I pass one single GUID:

METHOD TEST2 BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY.

SELECT CAST( :GUID AS NVARCHAR(32) ) INTO RESULT FROM DUMMY; ENDMETHOD.

And it's working fine. However when I try to pass a set of GUIDS...

METHOD TEST3 BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY.

RESULT = SELECT CAST( PARTNER_GUID_X16 AS NVARCHAR(32) ) FROM :GUIDS; ENDMETHOD.

It gives me the error:

SQLSCRIPT message: return type mismatch: Procedure ZCL_DMSH_CAST_AMDP=>TEST3: Attribute name "PARTNER_GUID_C32" different from Attribute name: "CAST(PARTNER_GUID_X16 AS NVARCHAR(32))" &A0&A1&A2&A3&A4&A5&A6&A7&A8&A9

Please advise if it's possible what i'm trying to do, or if you see any workaround or have similar experience, or how can i analyze the problem deeper?

Thanks, Dima

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Apr 21, 2017 at 10:40 AM
0

I think using an alias name for the column should do the trick.

...
RESULT = SELECT CAST( PARTNER_GUID_X16 AS NVARCHAR(32) ) AS "PARTNER_GUID_C32" FROM :GUIDS; 
...
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Florian,

Thanks a lot, it really worked out!

BR, Dima

0