SQL Server错误“字符串数据,右截断"是什么意思?是什么意思,我该如何解决? [英] What does the SQL Server Error "String Data, Right Truncation" mean and how do I fix it?

查看:467
本文介绍了SQL Server错误“字符串数据,右截断"是什么意思?是什么意思,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在网站上进行一些性能测试,并且经常遇到以下错误:

We are doing some performance tests on our website and we are getting the following error a lot:

*** 'C:\inetpub\foo.plex' log message at: 2008/10/07 13:19:58
DBD::ODBC::st execute failed: [Microsoft][SQL Native Client]String data, right truncation (SQL-22001) at C:\inetpub\foo.plex line 25.

第25行如下:

SELECT DISTINCT top 20 ZIP_CODE, CITY, STATE FROM Zipcodes WHERE (ZIP_CODE like ?) OR (CITY like ?) ORDER BY ZIP_CODE

最后,这是perl代码.

And lastly, this is perl code.

有什么想法吗?

编辑:这里的问题是我在zip文件中搜索字符串"74523%",该字符串过长.我最后只是不给%添加五个数字.

EDIT: the issue here was that I was searching in the zip file with the string "74523%" which is too long. I ended up just not adding the % if they give five digits.

推荐答案

ZIP_CODE提供的参数(长度)大于ZIP_CODE的列宽,或者为CITY提供的参数较大(在长度)小于CITY的列宽.

Either the parameter supplied for ZIP_CODE is larger (in length) than ZIP_CODEs column width or the parameter supplied for CITY is larger (in length) than CITYs column width.

知道为两个?占位符提供的值会很有趣.

It would be interesting to know the values supplied for the two ? placeholders.

这篇关于SQL Server错误“字符串数据,右截断"是什么意思?是什么意思,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆