0

What am I doing wrong. When I run

insert into tblconfig_extensiongroupMembers (FKExtension,FKextensiongroup)
    values ('C7972F9-56SC-951S-CSRS-15VDAR4895W2','F15745S4-R512-45RD-84S0-5DSWW16A526W') 

I get the following error conversion failed when converting from a character string to uniqueidentifier?

2
  • And what is the table definition? Commented Oct 14, 2015 at 15:18
  • 1
    Your first value only has 7 values in the first portion. It should be 8. Commented Oct 14, 2015 at 15:27

2 Answers 2

3

Besides the length issue mentioned by others, the value should only contain hexadecimal digits.

Your value contains invalid characters e.g. S, R, W and V.

Sign up to request clarification or add additional context in comments.

Comments

1

The problem is in the format of your character string, it should be in the following format as specified at MSDN:

By converting from a string constant in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, in which each x is a hexadecimal digit in the range 0-9 or a-f. For example, 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid uniqueidentifier value.

Working sample with 8 characters in first portion:

CREATE TABLE #tmp   (id UNIQUEIDENTIFIER)

INSERT INTO #tmp
        ( id )
VALUES  ( '12345678-1234-1234-1234-123456789012')

SELECT * FROM #tmp

DROP TABLE #tmp

Comparison of values:

C7972F9-56SC-951S-CSRS-15VDAR4895W2  -- (Bad format)
12345678-1234-1234-1234-123456789012 -- (Good format)

1 Comment

I did end up fixing the hexadecimal part to the below info but still get the error: insert into tblconfig extensiongroupMembers (FKExtension,FKextensiongroup) values ('C7972F9-4CBB-BCCE-8BF9E1097851','F49716C4-A318-45EC-89D0-2EDBB19A469E')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.