Conversion failed when converting from a character string to

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
Key
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 29.01.2009, 16:02

Conversion failed when converting from a character string to

Post by Key »

I have problem with iserted record to MSSQL 2005.

in SQL server :
---------
Column Name - ROWGUID
DateType - uniqueidentifier

in Delphi code:
--------
ZTable1.Insert;
ZTable1.FieldByName('SURNAME');
ZTable1.Post;
..... I can´t fill column ROWGUID

->

---------------------------
Error!
---------------------------
Conversion failed when converting from a character string to uniqueidentifier
---------------------------
OK
---------------------------

Why?
JWBokx
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 24.03.2009, 11:52

Post by JWBokx »

Normaly the value for a uniqueidentifier is generated bij de server.
This can be done in a trigger, setting the default value for the field to newid().
Have you added persistent fields to the table component?
In that case Delphi will fill the field with something like '' (empty string).
And the default of the server is not used.

Why don't you use a Query component?
Then you just don't select the column, and the server will do de rest.

J.W. de Bokx
Post Reply