简体   繁体   English

在SQL Server中存储大量数据

[英]Store huge amount of data in SQL Server

create table article
(
     ArticleID int constraint cnst-name Primary key,
     Description datatype
)

I am creating this table in SQL Server 2014. I am trying to create a table where I can store articles with huge data (it can be 1000-2000 words article description). 我正在SQL Server 2014中创建此表。我试图创建一个表,可以在其中存储具有大量数据的文章(文章描述可以为1000-2000字)。 I don't know which data type to choose for description column. 我不知道要为描述列选择哪种数据类型。

I chose varchar(max) but there is a limitation that each row has to be <= 900 bytes. 我选择varchar(max)但有一个限制,即每行必须<= 900字节。 Please guide me if my table structure is right. 如果我的表结构正确,请指导我。

Thanking in anticipation. 感谢期待。

Use VARCHAR(max) . 使用VARCHAR(max) 2000 words in a .txt file is around 13kb. .txt文件中的2000个单词约为13kb。 I would not call that 'huge'. 我不会称其为“巨大”。

I would use nvarchar(max) . 我会使用nvarchar(max) Unlike varchar is supports unicode. varchar不同,它支持unicode。 The limit 2GB should be enough. 2GB的限制应该足够了。

The limit of row size is 8060B, so You can not store more than about 4000 unicode characters in the row. 行大小的限制是8060B,因此您在该行中不能存储超过4000个unicode字符。 But the restriction does not apply here, because nvarchar(max) is not stored in the row. 但是此限制不适用于此处,因为nvarchar(max)未存储在行中。 The row contains pointer only. 该行仅包含指针。 This one indirection is the price for the "unlimited" size. 这个间接是“无限”大小的价格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM