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
 General SQL Server Forums
 New to SQL Server Programming
 how to update

Author  Topic 

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-04-20 : 14:43:44

I tried to update Hlink field with passing ID and PID values.
I got following err:

Msg 8152, Level 16, State 14, Line 21
String or binary data would be truncated.


declare @tbl1 table
(ID INT,
PID INT,
HLink varchar(50)
)

INSERT INTO @tbl1
SELECT 1, 101,NULL

INSERT INTO @tbl1
SELECT 2, 202,NULL

INSERT INTO @tbl1
SELECT 3,111,NULL

INSERT INTO @tbl1
SELECT 5, 222,NULL

update @tbl1 set Hlink='<a href=/detail.aspx?ID='+convert(varchar,ID)+'&PID='+convert(varchar,PID)+' TARGET=_BLANK>Detail</a>'
select * from @tbl1

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-04-20 : 14:44:56
Make size of hlink more than 50
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-04-20 : 14:50:33
i got same error
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-04-20 : 14:57:28
I just declared it as 100 and it worked.

HLink varchar(100)
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-04-20 : 15:00:40
thanks
Go to Top of Page
   

- Advertisement -