1. 程式人生 > >SQL Server 最多可存多少列!

SQL Server 最多可存多少列!

SQL   Server   的每個資料庫最多可儲存   20   億個表,每個表可以有   1024   列。
表的行數及總大小僅受可用儲存空間的限制。
每行最多可以儲存   8,060   位元組。
如果建立具有   varchar、nvarchar   或   varbinary   列的表,並且列的位元組總數超過   8,060   位元組,雖然仍可以建立此表,但會出現警告資訊。
如果試圖插入超過   8,060   位元組的行或對行進行更新以至位元組總數超過   8,060,將出現錯誤資訊並且語句執行失敗。 

幫助原文"

SQL Server can have as many as two billion tables per database and 1,024 columns per table. The number of rows and total size of the table are limited only by the available storage. The maximum number of bytes per row is 8,060. If you create tables with varchar

, nvarchar,or varbinary columns in which the total defined width exceeds 8,060 bytes, the table is created, but a warning message appears. Trying to insert more than 8,060 bytes into such a row or to update a row so that its total row size exceeds 8,060 produces an error message and the statement fails.

CREATE TABLE statements that include a sql_variant

column can generate the following warning:

The total row size (xx) for table 'yy' exceeds the maximum number of bytes per row (8060). Rows that exceed the maximum number of bytes will not be added.

This warning occurs because sql_variant can have a maximum length of 8016 bytes. When a sql_variant column contains values close to the maximum length, it can overshoot the row's maximum size limit.

Each table can contain a maximum of 249 nonclustered indexes and 1 clustered index. These include the indexes generated to support any PRIMARY KEY and UNIQUE constraints defined for the table.

SQL Server does not enforce an order in which DEFAULT, IDENTITY, ROWGUIDCOL, or column constraints are specified in a column definition.