I have a table with uniqueidentifier column. Insert script looks like this :
INSERT INTO [Users] ([UserId], [Name], [Surname]) VALUES (NEWID(), 'SomeName', 'SomeSurname')
NEWID() creates new GUID, which is inserted to table. I would like to create some data with defined id column, not automatically generated. E.g. 'a0000000-0000-0000-0000-000000000000'. This code doesn't work because it throws error 'String or binary data would be truncated.' :
INSERT INTO [Users] ([UserId], [Name], [Surname]) VALUES ('a0000000-0000-0000-0000-000000000000', 'SomeName', 'SomeSurname')
I tried cast this custom guid, but I was not successful as well.
INSERT INTO [Users] ([UserId], [Name], [Surname]) VALUES (CAST('a0000000-0000-0000-0000-000000000000' AS uniqueidentifier), 'SomeName', 'SomeSurname')
Do you have any clue how I can solve inserting data with custom defined ID?