SQL Server 中的 char、nchar、varchar 和 nvarchar 有什么区别? [英] What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

查看:26
本文介绍了SQL Server 中的 char、nchar、varchar 和 nvarchar 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

nvarchar 是什么意思?

charncharvarcharnvarchar 在 SQL Server 中有什么区别?>

What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

推荐答案

只是为了澄清...或总结...

Just to clear up... or sum up...

  • ncharnvarchar 可以存储 Unicode 字符.
  • charvarchar 不能存储 Unicode 字符.
  • charnchar固定长度,它们将为您指定的字符数保留存储空间,即使您没有用完所有空间.
  • varcharnvarcharvariable-length 只会用完您存储的字符的空格.它不会像 charnchar 那样保留存储.
  • nchar and nvarchar can store Unicode characters.
  • char and varchar cannot store Unicode characters.
  • char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don't use up all that space.
  • varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar.

ncharnvarchar 将占用两倍的存储空间,因此只有在需要 Unicode 支持时才使用它们可能是明智的.

nchar and nvarchar will take up twice as much storage space, so it may be wise to use them only if you need Unicode support.

这篇关于SQL Server 中的 char、nchar、varchar 和 nvarchar 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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