sql server2005在创建表的同时是怎样加主键?
答案:2 悬赏:40 手机版
解决时间 2021-04-02 13:03
- 提问者网友:火车头
- 2021-04-02 05:51
sql server2005在创建表的同时是怎样加主键?
最佳答案
- 五星知识达人网友:时间的尘埃
- 2021-04-02 07:29
create table advert (
id varchar(20) not null default '' primary key, --同时指定该字段为主键
atadvid varchar(20) not null default '',
atstarthour int default 0,
atendhour int default 24
);
或者
create table advert (
id varchar(20) not null default '',
atadvid varchar(20) not null default '',
atstarthour int default 0,
atendhour int default 24,
primary key (id) --单独指定
);
id varchar(20) not null default '' primary key, --同时指定该字段为主键
atadvid varchar(20) not null default '',
atstarthour int default 0,
atendhour int default 24
);
或者
create table advert (
id varchar(20) not null default '',
atadvid varchar(20) not null default '',
atstarthour int default 0,
atendhour int default 24,
primary key (id) --单独指定
);
全部回答
- 1楼网友:持酒劝斜阳
- 2021-04-02 08:43
ID Int Identity(1,1) Not Null Primary Key,
能看懂吗
Primary Key就是主键
Identity(1,1) 是自动增加最小1每次加1
能看懂吗
Primary Key就是主键
Identity(1,1) 是自动增加最小1每次加1
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯