Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 getting Error message inserting rows to Temp table

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-02-07 : 14:55:58
I am using the following on some data bases i am getting the result with out any error message, but on some of them i am getting the following error message:


Msg 8152, Level 16, State 10, Line 11
String or binary data would be truncated.
The statement has been terminated.

(0 row(s) affected)

Can you please tell me am i doing something wron, i am constructing this logic for a stored Proc, which i am planning to build as a first step doing in pieces.


CREATE TABLE #TEMP
(
id INT,
ocdata nvarchar(4000),
tiffile varchar(100),
type varchar(25),
type_id int
)


insert into #TEMP(id,ocdata,tiffile,type,type_id)
select id,ocdata,tiffile,type,type_id from TableOcData where ocdata LIKE '%Station%' and type = 'PM'

Select * from #TEMP order by id

Drop table #TEMP







thank you very much for your help.

Bodestone
Starting Member

18 Posts

Posted - 2009-02-07 : 15:00:16
You need to check the size of the nvarchar fields in TableOCData and make sure the ones in the temp table are as big or bigger.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-07 : 15:02:56
What happens when you use nvarchar(max) for ocdata?
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-02-07 : 15:47:37
Thanks it worked with nvarchar(max)
quote:
Originally posted by sodeep

What happens when you use nvarchar(max) for ocdata?

Go to Top of Page
   

- Advertisement -