This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 请问有没有哪一位做过比较: 在SQL Server数据库表的设计当中,字段有Default值和没有Default值性能方面有没有差别? 或者各有什么优缺点?
-easternbaby(东方娃娃);
2002-9-12
(#742935@0)
-
Default只是在insert时插入一个默认值,对性能应该没什么影响
-miketany(MIKE老狼);
2002-9-12
(#743053@0)
-
谢谢了!顺便问另一个问题:在SQL Server中如何去掉列的Default设置以便用 ALTER TABLE table_name DROP COLUMN column_name 来删除列?或者有别的简单办法删除列?
-easternbaby(东方娃娃);
2002-9-12
(#743283@0)
-
There are two different types of defaults in SQL Server, which are the default object and default constraint.1. Default object
(1) If that object hasn't been bound to the column, then execute
use database_name
drop default default_name
(2) If that object has been bound to the column, then execute
use database_name
EXEC sp_unbindefault 'table_name.column_name'
DROP DEFAULT default_name
2. Default constraint
get the constraint name for that default by executing
sp_help table_name
then
alter table drop constraint constaint_name
-yangn(Raymond);
2002-9-12
{450}
(#743327@0)
-
有default的缺点:如果该列于其他表相关,default的值(数据类型是一般为0)可能会造成integrity的问题。所以如果同其他表关联时,最好没有default,如果单纯是一数据,最好设置。
-lilyba(Sunshine);
2002-9-12
(#743296@0)