SQL Server-列顺序重要吗? [英] SQL Server - Does column order matter?

查看:117
本文介绍了SQL Server-列顺序重要吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在性能和优化方面:

  • 在SQL Server中构造表时,我按什么顺序放置列是否重要?
  • 我的主键是否在第一列有关系吗?
  • 构造多字段索引时,各列是否相邻并不重要?
  • 使用ALTER TABLE语法,是否可以指定我要添加列的位置?
    • 如果没有,如何将列移动到其他位置?
    • When constructing a table in SQL Server, does it matter what order I put the columns in?
    • Does it matter if my primary key is the first column?
    • When constructing a multi-field index, does it matter if the columns are adjacent?
    • Using ALTER TABLE syntax, is it possible to specify in what position I want to add a column?
      • If not, how can I move a column to a difference position?

      推荐答案

      在SQL Server 2005中,可为空的可变长度列的放置会产生空间影响-在定义的末尾放置可为空的可变大小列可以减少空间消耗

      In SQL Server 2005, placement of nullable variable length columns has a space impact - placing nullable variable size columns at the end of the definition can result in less space consumption.

      SQL Server 2008添加了"SPARSE"列功能,从而消除了这种差异.

      SQL Server 2008 adds the "SPARSE" column feature which negates this difference.

      请参见这里.

      这篇关于SQL Server-列顺序重要吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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