Veröffentlicht Sat, 16 Mar 2024 10:07:44 GMT von Guido Wieland WIeland Document Solutions & Services GmbH DMS Solution Engineer
Dear Community

I have the following scenario or SQL query in a workflow data assignment:
 
SELECT [title] FROM [RV - system data] WHERE DW_ID_LONG = GV_Standard_Aufwandkonto_Nr
 
Variables/types used:

Database field => DW_ID_LONG = Text or NVARCHAR(12)
Global workflow variable => GV_Standard_Aufwandkonto_Nr = Numeric
 
From an SQL perspective, the following applies in principle:

Generally MSSQL will transfer data from a varchar field to an INT (numeric field) as an implicit conversion - meaning that you do not need to specify a conversion. You will however need to pay careful attention to decimal places if you use an INT (numeric field).
(From <https://support.docuware.com/en-US/forums/help-with-technical-problems/c3e2967b-2d36-ea11-8454-0003ff59ab14>)
 
Accordingly, and assuming that the database field DW_ID_LONG only contains integer values in the range of -2147483648 and 2147483648, I believe that in the case of a pure WHERE comparison, no explicit data type conversion (e.g. using CAST (DW_ID_LONG as INT)) is necessary and the two variables can be compared directly with each other despite natively different data types.

Basically, the whole thing seems to work, but due to internal discussions with colleagues, opinions differ and I would like to ask for opinions and/or experiences from the community.

Best regards
Guido
Veröffentlicht Mon, 18 Mar 2024 09:26:37 GMT von Simon H. Hellmann Toshiba Tec Germany Imaging Systems GmbH IT-Consultant Document Management Solutions
Hello Guido Wieland,

just to be safe I would always use explicit conversion everywhere I can.
In my experience, vendors tend to change standards on implicit conversion sometimes which in turn might break your workflow.

Greetings from Germany,
Simon H. Hellmann
DocuWare System Consultant
Veröffentlicht Mon, 18 Mar 2024 16:35:16 GMT von Guido Wieland WIeland Document Solutions & Services GmbH DMS Solution Engineer

Hi Simon,

Thanks for your feedback and yes, sure I get your drift for that matter.

To cover for mentioned eventualities it would definitely be advised to go for an explizit CAST or CONVERT.

Nevertheless, presuming mentioned implicit conversion is and remains supported by vendor, in such case the outlined example would indeed work just fine as long as DW_ID_LONG contains only integer values, correct?

Best regards

Guido

Sie müssen angemeldet sein um Beiträge in den Foren zu erstellen.