Hi All
I am having sometrouble with a update statement.
The table is about 60 columns, apart from the first one all are NULL.
insert into customer (id,sitename)
values (newid(),'TEST')
The error message I am getting is:
Server: Msg 8152, Level 16, State 6, Line 1
String or binary data would be truncated.
The statement has been terminated.
The column I am inserting into is nvarchar (50) so I am a bit stuck as I dont understand the error

Update statement
Gazelle
create table tmp1
(id uniqueidentifier,
sitename nvarchar(50))
go
insert into tmp1 (id,sitename)
values (newid(),'TEST')
select * from tmp1
--------------
(1 row(s) affected)
id sitename
------------------------------------ --------------------------------------------------
AC9D150F-D20B-418C-9E10-2E62AF1CDD56 TEST
(1 row(s) affected)
--------------
works like a charm for me. Please double-check the DDL statement for your table and post it here.
serras
Hi
The id column is a uniqueidentifier and primary key, the sitename is the nvarchar
Shailaja
Duke of URL
Hi
The script for the table is below, I have set it up in my test db and I can insert ok...... so I am not sure why I get the error message with the existing table
CREATE TABLE [dbo].[customer] (
[id] uniqueidentifier ROWGUIDCOL NOT NULL ,
[created_by] [uniqueidentifier] NULL ,
[date_created] [datetime] NULL ,
[state] [int] NULL ,
[currency_code] [int] NULL ,
[currency_rate] [float] NULL ,
[class] [int] NULL ,
[stage] [int] NULL ,
[name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[address1] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[address2] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[address3] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[town] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[county] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[country] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[postcode] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[phone] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[fax] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[internet] [nvarchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[sales_region] [int] NULL ,
[parent_company] [uniqueidentifier] NULL ,
[sic_code] [int] NULL ,
[account_potential] [float] NULL ,
[cp_score] [float] NULL ,
[no_of_employees] [int] NULL ,
[turnover] [float] NULL ,
[freephone] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[owner] [uniqueidentifier] NULL
) ON [PRIMARY]
GO
Indian Scorpion
I don't see the sitename column, there is one that is named 'name'
Denis the SQL Menace
http://sqlservercode.blogspot.com/Emrys Mydhrin
I believe the error message is referring to your call to NEWID(). This function returns a value of type "uniqueidentifier" (which I believe can be converted successfully into something of varchar(255) from examples I have seen).
When you say the column you are inserting into is nvarchar(50) are you talking about the "id" column