create table 学生表(
sdept char(10),
default c1 'aa' for sdept
)
谁知道这个default错在哪里了?
上网查了好久,都没找到,哪位知道?

解决方案 »

  1.   


    create table 学生表( 
    sdept char(10) default('aa') 

      

  2.   

    c1是指? 好像没有default for 这种用法吧
      

  3.   

    DEFAULT 定义每列只能有一个 DEFAULT 定义。 
    DEFAULT 定义可以包含常量值、函数、SQL-92 niladic 函数或 NULL
    DEFAULT 定义中的 constant_expression 不能引用表中的其它列,也不能引用其它表、视图或存储过程。 
    不能在数据类型为 timestamp 的列或具有 IDENTITY 属性的列上创建 DEFAULT 定义。 
    如果用户定义数据类型绑定到默认对象,则不能在该用户定义数据类型的列上创建 DEFAULT 定义
      

  4.   

    create table 学生表( 
    sdpet char(10)

    alter table 学生表
    add constraint DF default ('aa') for sdpet 
      

  5.   

    sqlserver 2000中有这样的语法吗?
      

  6.   

    default <约束名> <默认值> for <列名>
    sqlserver 2000中有上述的语法吗?教材上是这么写的
      

  7.   

    create table 学生表( 
    id int,
    sdpet char(10)

    go
    CREATE DEFAULT de_sdpet AS 'aa'
    go
    exec sp_bindefault 'de_sdpet', '学生表.sdpet';
    goinsert into 学生表 (id) select 1select * from 学生表