zoukankan      html  css  js  c++  java
  • sql sqlserver identity插入记录设置和 CLUSTERED | NONCLUSTERED 区别

    代码
    ALTER TABLE [CheckOutType] WITH NOCHECK ADD CONSTRAINT [PK_CheckOutType] PRIMARY KEY NONCLUSTERED ( [ID] )
    SET IDENTITY_INSERT [CheckOutType] ON

    INSERT [CheckOutType] ([ID],[Code],[Name],[flag]) VALUES ( 1,'XJ','现金',0)

    SET IDENTITY_INSERT [CheckOutType] OFF
    CLUSTERED | NONCLUSTERED
        指定为 PRIMARY KEY 或 UNIQUE 约束创建聚集或非聚集索引。PRIMARY KEY 约束默认为 CLUSTERED;UNIQUE 约束默认为 NONCLUSTERED。
        如果表中已存在聚集约束或索引,那么在 ALTER TABLE 中就不能指定 CLUSTERED。如果表中已存在聚集约束或索引,PRIMARY KEY 约束默认为 NONCLUSTERED。
    最大区别在于clustered是物理上实现数据排序,并且同一个表里只能有一个clustered索引,而nonclustered是逻辑上的排序。
    There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
    A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

    CLUSTERED | NONCLUSTERED    指定为 PRIMARY KEY 或 UNIQUE 约束创建聚集或非聚集索引。PRIMARY KEY 约束默认为 CLUSTERED;UNIQUE 约束默认为 NONCLUSTERED。
        如果表中已存在聚集约束或索引,那么在 ALTER TABLE 中就不能指定 CLUSTERED。如果表中已存在聚集约束或索引,PRIMARY KEY 约束默认为 NONCLUSTERED。
    最大区别在于clustered是物理上实现数据排序,并且同一个表里只能有一个clustered索引,而nonclustered是逻辑上的排序。There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
    A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

  • 相关阅读:
    git 常用操作命令行
    Mysql 命令行...
    bootstrap
    10.11 android输入系统_补充知识_activity_window_decor_view关系
    10.10 android输入系统_APP获得并处理输入事件流程
    10.9 android输入系统_APP跟输入系统建立联系和Dispatcher线程_分发dispatch
    10.8 android输入系统_实战_使用GlobalKey一键启动程序
    10.7 android输入系统_Dispatcher线程情景分析_Reader线程传递事件和dispatch前处理
    10.6 android输入系统_Dispatcher线程_总体框架
    10.5 android输入系统_Reader线程_使用EventHub读取事件和核心类及配置文件_实验_分析
  • 原文地址:https://www.cnblogs.com/wucg/p/1758659.html
Copyright © 2011-2022 走看看