I am getting below error when I run sql query while copying data from one table to another,
Msg 8170, Level 16, State 2, Line 2 Insufficient result space to convert uniqueidentifier value to char.
My sql query is,
INSERT INTO dbo.cust_info (
uid,
first_name,
last_name
)
SELECT
NEWID(),
first_name,
last_name
FROM dbo.tmp_cust_info
My create table scripts are,
CREATE TABLE [dbo].[cust_info](
[uid] [varchar](32) NOT NULL,
[first_name] [varchar](100) NULL,
[last_name] [varchar](100) NULL)
CREATE TABLE [dbo].[tmp_cust_info](
[first_name] [varchar](100) NULL,
[last_name] [varchar](100) NULL)
I am sure there is some problem with NEWID(), if i take out and replace it with some string it is working.
I appreciate any help. Thanks in advance.
uniqueidentifier
column type to store guids, notcharacter(36)
(var is no needed since is not variable, is it?).uniqueidentifier
only needs 16 bytes for storage, as opposed to 36 needed for the character representation of a guid. – Brakesman