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
 String or binary data would be truncated

Author  Topic 

mgm57
Starting Member

8 Posts

Posted - 2010-12-20 : 22:38:50
Hi, I would like to seek help with regards to this issue I am encountering an error in MS SQL 2005 "String or binary data would be truncated." when I run my query below:

SELECT myTableID,
myID,
[month],
CASE
WHEN (LEN(subject_line) > 51) THEN REPLACE(subject_line,subject_line,SUBSTRING(dbo.fnStripHTMLTags(subject_line),0,30)+'...')
ELSE subject_line
END AS subject_line
FROM [dbo].[myTable]
WHERE ([month] = 12
AND myID = 34
AND cType = 1
AND [Year] = '2010')
ORDER BY LastUpdatedDate DESC

When I remove this line of code from the query above, I did not encounter the error:
CASE WHEN (LEN(subject_line) > 51) THEN REPLACE(subject_line,subject_line,SUBSTRING(dbo.fnStripHTMLTags(subject_line),0,30)+'...') ELSE subject_line END AS subject_line

But this line of code is needed in my query. What should I do to fix this? Any help is greatly appreciated.

Thank you.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-12-20 : 23:06:49
Dupe:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=154398
Go to Top of Page
   

- Advertisement -