Conversion failed when converting from a character string to uniqueidentifier


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?


I don’t think uniqueid is supported.

what is the data type of FormResponseHeaderID in the db?


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.



Hello Anthony

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

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 ?