注册 登录
编程论坛 SQL Server论坛

关于排序规则和[datetime]数据类型

冬日暖阳 发布于 2007-07-04 10:29, 924 次点击

use [db_student]
go
if exists (select *from dbo.sysobjects where id = object_id('[dbo].[t_student]')and objectproperty(id,'isusertable') = 1)
drop table [dbo].[student]
go
create table [dbo].[student]
([s_studentno][char](8)collate chinese_prc_ci_as not null,
[s_name][char](20)collate chinese_prc_ci_as not null,
[s_sex][char](2)collate chinese_prc_ci_as not null,
[s_department][char](20)collate chinese_prc_ci_as not null,
[s_class][char](10)collate chinese_ prc_ci_as not null,
[s_birthday][datetime](8)
[s_entrance][char](6)collate chinese_prc_ci_as not null)
on [primary]

alter table [dbo].[student]with nocheck add
constraint [pk_student]primary key clustered
([s_studentno])
on [primary]
go

服务器: 消息 448,级别 16,状态 2,行 6
排序规则 'chinese_' 无效。

后来我进行了一些更改:把排序规则去掉了,还有[datetime]后不可以限制字段宽度.这是为什么呀.下面这个语句就可以执行.可我有点不明白
create table [dbo].[student]
([s_studentno][char](8)not null,
[s_name][char](20)not null,
[s_sex][char](2)not null,
[s_department][char](20)not null,
[s_class][char](10)not null,
[s_birthday][datetime]
[s_entrance][char](6)not null)
on [primary]

alter table [dbo].[student]with nocheck add
constraint [pk_student]primary key clustered
([s_studentno])
on [primary]
go

0 回复
1