伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1187531665.html
说明 对于每台计算机,由 NEWID 返回的值不同。所显示的数字仅起解释说明的作用。
B.在 CREATE TABLE 语句中使用 NEWID
下面的示例创建具有 uniqueidentifier 数据类型的 cust 表,并使用 NEWID 将默认值填充到表中。为 NEWID() 赋默认值时,每个新行和现有行均具有 cust_id 列的唯一值。
-- Creating a table using NEWID for uniqueidentifier data type.
CREATE TABLE cust
(
cust_id uniqueidentifier NOT NULL
DEFAULT newid(),
company varchar(30) NOT NULL,
contact_name varchar(60) NOT NULL,
address varchar(30) NOT NULL,
city varchar(30) NOT NULL,
state_province varchar(10) NULL,
postal_code varchar(10) NOT NULL,
country varchar(20) NOT NULL,
telephone varchar(15) NOT NULL,
NEWID创建uniqueidentifier类型的唯一值
'http://www.etoow.com/html/2007-08/1187531665.html