661
Views
3
Comments
Conversion failed when converting from a character string to uniqueidentifier
Question

Hi,

I have a database with many foreign key and primary key pairs all based on UNIQUEIDENTIFIER data types. When I go to create a new record I receive the following error:

"Conversion failed when converting from a character string to uniqueidentifier"

Is there something I have wrong?


2024-12-19 12-19-39
Amal
 
MVP

Hi 

I don’t think uniqueid is supported.

what is the data type of FormResponseHeaderID in the db?

Regards

2018-10-29 08-31-03
João Marques
 
MVP

Hi Anthony,


Identifier corresponds to an integer so it will fail.

What you probably want to do is to use the TextToTextIdentifier() whose output will be an identifier of the type text therefore the cast will work. You will also need to guarantee that the fields FormResponseHeaderId and FormsId are identifiers of the type Text, otherwise you will be trying to fit a text inside an integer attribute in the database.


Cheers,

João

2024-12-19 12-19-39
Amal
 
MVP

Hello Anthony

If you see the data type mapping with Sql server and OutSystems 

https://success.outsystems.com/Documentation/10/Reference/OutSystems_Language/Extensibility_and_Integration/Mapping_External_DB_Data_Types_to_OutSystems_Data_Types

uniqueidentifier is mapped as Text, so I believe there is no need to do any conversion, just pass the GUID text as is.  

Also the FormResponseHeaderID and FormsID should be of type Text.  Can you confirm ?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.