2 luoyebingcheng luoyebingcheng 于 2014.05.21 13:06 提问

从网上下的mysql代码想改成sql server的,能帮我看看我改的代码对吗?

网上的
drop database bbs;

create database bbs;

use bbs;

CREATE TABLE admin (
id int(11) NOT NULL AUTO_INCREMENT,
username varchar(50) DEFAULT NULL,
password varchar(50) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

CREATE TABLE article (
id int(11) NOT NULL AUTO_INCREMENT,
author varchar(50) DEFAULT NULL,
title varchar(255) DEFAULT NULL,
content text,
publishDate datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

CREATE TABLE comment (
id int(11) NOT NULL AUTO_INCREMENT,
rootid int(11) DEFAULT NULL,
author varchar(50) DEFAULT NULL,
content text,
publishDate datetime DEFAULT NULL,
isuser int(11) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;

CREATE TABLE log (
id int(11) NOT NULL AUTO_INCREMENT,
adminName varchar(50) DEFAULT NULL,
operate varchar(50) DEFAULT NULL,
createDate datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8;

CREATE TABLE user (
id int(11) NOT NULL AUTO_INCREMENT,
username varchar(50) DEFAULT NULL,
password varchar(50) DEFAULT NULL,
email varchar(50) DEFAULT NULL,
creatTime datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

insert into admin values(null,'admin','21232F297A57A5A743894A0E4A801FC3');

insert into article values(null,'测试员','测试一','测试一',now());
insert into article values(null,'测试员','测试二','测试二',now());
insert into article values(null,'测试员','测试三','测试三',now());
insert into article values(null,'测试员','测试四','测试四',now());
insert into article values(null,'测试员','测试五','测试五',now());
insert into article values(null,'测试员','测试六','测试六',now());

insert into comment values(null,'1','灌水员','沙发',now(),1);
insert into comment values(null,'1','灌水员','板凳',now(),1);
insert into comment values(null,'1','灌水员','地板',now(),1);
insert into comment values(null,'2','灌水员','沙发',now(),1);
insert into comment values(null,'2','灌水员','板凳',now(),1);
insert into comment values(null,'3','灌水员','沙发',now(),1);
insert into comment values(null,'3','我就是个路过的','顶',now(),0);
insert into comment values(null,'3','我就是个路过的','灌水',now(),0);
insert into comment values(null,'3','我就是个路过的','不错',now(),0);

。。。。。。。。。。。。。。。。我的。。。。。。。。。。。。。。。。。。
drop database bbs2;

create database bbs2;

use bbs2;

CREATE TABLE admin (
id int NOT NULL identity(2,1) PRIMARY KEY,
username varchar(50) DEFAULT NULL,
password varchar(50) DEFAULT NULL,
);

CREATE TABLE article (
id int NOT NULL PRIMARY KEY identity(11,1),
author varchar(50) DEFAULT NULL,
title varchar(255) DEFAULT NULL,
content text,
publishDate datetime DEFAULT NULL,
);

CREATE TABLE comment (
id int NOT NULL PRIMARY KEY identity(26,1),
rootid int DEFAULT NULL,
author varchar(50) DEFAULT NULL,
content text,
publishDate datetime DEFAULT NULL,
isuser int DEFAULT NULL,
);

CREATE TABLE log (
id int NOT NULL PRIMARY KEY identity(36,1),
adminName varchar(50) DEFAULT NULL,
operate varchar(50) DEFAULT NULL,
createDate datetime DEFAULT NULL,

);

CREATE TABLE user,
username varchar(50) DEFAULT NULL,
password varchar(50) DEFAULT NULL,
email varchar(50) DEFAULT NULL,
creatTime datetime DEFAULT NULL,
);
insert into admin values('admin','21232F297A57A5A743894A0E4A801FC3');

insert into article values('测试员','测试一','测试一',getDate());
insert into article values('测试员','测试二','测试二',getDate());
insert into article values('测试员','测试三','测试三',getDate());
insert into article values('测试员','测试四','测试四',getDate());
insert into article values('测试员','测试五','测试五',getDate());
insert into article values('测试员','测试六','测试六',getDate());

insert into comment values('1','灌水员','沙发',getDate(),1);
insert into comment values('1','灌水员','板凳',getDate(),1);
insert into comment values('1','灌水员','地板',getDate(),1);
insert into comment values('2','灌水员','沙发',getDate(),1);
insert into comment values('2','灌水员','板凳',getDate(),1);
insert into comment values('3','灌水员','沙发',getDate(),1);
insert into comment values('3','我就是个路过的','顶',getDate(),0);
insert into comment values('3','我就是个路过的','灌水',getDate(),0);
insert into comment values('3','我就是个路过的','不错',getDate(),0);

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!