. Advertisement .
..3..
. Advertisement .
..4..
I get the error message:
Conversion failed when converting from a character string to uniqueidentifier.
Has anyone ever faced this problem? How to troubleshoot the “ conversion failed when converting from a character string to uniqueidentifier” But the problem is appearing when I try to operate the following program
insert into [db].[dbo].[table] (myid,friendid,time1,time2) values
( CONVERT(uniqueidentifier,'0C6A36BA-10E4-438F-BA86-0D5B68A2BB15'),
CONVERT(uniqueidentifier,'DF215E10-8BD4-4401-B2DC-99BB03135F2E'),
'2014-01-05 02:04:41.953','2014-01-05 12:04:41.953')
id uniqueidentifier,
myid uniqueidentifier,
friendid uniqueidentifier,
time1 datetime nullable,
time2 datetime nullable
The cause: The ID column wasn’t getting any value.
Solution: You must check unique identifier column and that particular field must be given a different value. If you give the same value, it will not work. It enforces uniqueness of the key. Below is the code:
MSDN Documentation Here
The following code can be used to convert a string into a unique identifier to add context to M.Ali’s Answer
If this doesn’t work, make sure that you have entered the GUID