读书人

初用查询分析器遇到的一个查询更新有关

发布时间: 2012-01-28 22:06:13 作者: rapoo

初用查询分析器遇到的一个查询更新问题
问题是这样的:

在 pubs 数据库中,用 select * from titles ,得到表的所有信息后,表里有这么一行
title_id title .......................................
16 TC3218 Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean

我用 update titles set title=replace(title, ' ', '空格 ') where title_id = 'tc3218 '
出现如下错误信息:

服务器: 消息 8152,级别 16,状态 9,行 1
将截断字符串或二进制数据。
语句已终止。

而我把 title 对应的那条 Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean 复制过来,用
select replace( 'Onions, Leeks, and Garlic: Cooking Secrets of the Mediterranean ', ' ', '空格 ')
却没报错,而且得到了
Onions,空格Leeks,空格and空格Garlic:空格Cooking空格Secrets空格of空格the空格Mediterranean

请问这是怎么回事呢?
谢谢!!!


[解决办法]
xindekaishi() ( ) 信誉:100 Blog 加为好友 2007-5-5 22:32:47 得分: 0



补充一下,我同样用
update titles set title=replace(title, ' ', '空格 ') where title_id = 'XXXXXX '
处理别的行时又没错误.



-----------
不的原因就是,修改後的的度有超出表中字段定的度。

而上,不是所有的都不,句也。

update titles set title=replace(title, ' ', '空格 ') where title_id = 'PS1372 '

其余的,由於度有超出,都不。

读书人网 >SQL Server

热点推荐