在 SQL Server 2005 中,len() 和 datalength() 之间有什么区别? [英] In SQL Server 2005, what is the difference between len() and datalength()?

查看:27
本文介绍了在 SQL Server 2005 中,len() 和 datalength() 之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server 2005 中的 len() 和 datalength() 有什么区别?

What is the difference between len() and datalength() in SQL Server 2005?

推荐答案

DATALEN 将返回用于存储值的字节数:

DATALEN will return the number of bytes that are used to store the value:

http://msdn.microsoft.com/en-us/library/ms173486(SQL.90).aspx

LEN 将返回字符串中的字符数.由于字符串可以使用单字节或双字节字符,因此它与 DATALENGTH 的不同之处在于,无论单个字符有多长,您始终会得到 1:

LEN will return the number of characters in a string. Since a string can use single or double-byte characters, this differs from DATALENGTH in that you will always get 1, no matter how long a single character is:

http://msdn.microsoft.com/en-us/library/ms190329.aspx

这篇关于在 SQL Server 2005 中,len() 和 datalength() 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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