注册 登录
编程论坛 MySQL论坛

mysql怎么样建存储过程

dingpin 发布于 2008-08-12 22:58, 2322 次点击
怎么样建一个带输入参数的存储过程,哪位可以给一个例子的代码?
还有在mysql中建表的时候
比如说:
create table customer
(
id    int auto_increment Primary Key    not null,
name     varchar(20)  not null,
age      int  not null,
curDate  dateTime   not null
);

怎么样加默认值:
比如说:
create table customer
(
id    int auto_increment Primary Key    not null,
name     varchar(20)  not null,
age      int default(20) not null,
curDate  datetime   default(now())  not null
);
上面这样加是错的,不知道正确的写法的怎么样的?

请高手指点,谢谢...
4 回复
#2
dingpin2008-08-13 10:48
不会吧,没人会吗?
#3
落在秋天的叶2008-12-12 19:25
下面 那个我运行了下也不对~~~~
#4
无缘今生2008-12-15 13:56
create table customer
(
id    int auto_increment Primary Key    not null,
name     varchar(20)  not null,
age      int default 20 not null,
curDate  datetime   default now()  not null
);

age      int default 20 not null,//这句可以正常运行

其中curDate  datetime   default now()  not null会提示
“Invalid default value for 'curDate' ”
可能默认值不能是一个函数吧。
#5
aina2009-10-31 02:35
和 sql server基本一样啊!没有什么难的啊
1