Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
如果在转换或转换过程中未指定 varchar/nvarchar 的大小,则默认为 30 个字符。将 guid 转换为字符串需要 36 个字符。这就是您收到错误的原因。
其中任何一个都可以工作:
When you do not specify the size of your varchar/nvarchar during a cast or convert, it defaults to 30 characters. You need 36 characters to convert a guid to a string. That is why you get the error.
Either of these will work:
这个测试脚本对我来说效果很好...我只能建议您的 TaskId 可能不是像您所说的 NVARCHAR(50) ?尝试 sp_columns 只是为了检查...
This test script works fine for me... I can only suggest that maybe your TaskId isn't an NVARCHAR(50) like you say? Try an sp_columns just to check...
请尝试以下演员表:
Please try the following cast:
使用 varchar 数据类型,nvarchar 需要双倍大小
use varchar data type, nvarchar needs double size