mssql如何create字段呢?
create db 是新建数据库
create table 是新建表
那新建字段呢? 谢谢。
自己到sqlserver文档中查找create的语法示例吧
SQL code:
下例显示 pubs 数据库中所创建的三个表(jobs、employee 和 publishers)的完整表定义,其中包含所有的约束定义。
/* ************************** jobs table ************************** */
CREATE TABLE jobs
(
job_id smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
job_desc varchar(50) NOT NULL
DEFAULT 'New Position - title not formalized yet',
min_lvl tinyint NOT NULL
CHECK (min_lvl >= 10),
max_lvl tinyint NOT NULL
CHECK (max_lvl <= 250)
)
/* ************************* employee table ************************* */
CREATE TABLE employee
(
emp_id empid
CONSTRAINT PK_emp_id PRIMARY KEY NONCLUSTERED
CONSTRAINT CK_emp_id CHECK (emp_id LIKE
'[A-Z][A-Z][A-Z][1-9][0-9][0-9][0-9][0-9][FM]' or
emp_id LIKE '[A-Z]-[A-Z][1-9][0-9][0-9][0-9][0-9][FM]'),
/* Each employee ID consists of three characters that
represent the employee's initials, followed by a five
digit number ranging from 10000 through 99999 and then the
employee's gender (M or F). A (hyphen) - is acceptable
for the middle initial. */
fname varchar(20) NOT NULL,
minit char(1) NULL,
lname varchar(30)
相关问答:
一个总站.三个子站共四个ASP开发的站点;数据库是MSSQL2000;四个站各有自己的数据库(四个站点的库结构都是一样的.),各有自己的信息添加后台,四个站是独立的.四个站都在同一个服务器中.
现在需要现实:
一.如何让总站 ......
access时查询速度还蛮快的,现在转成mssql了,数据量并不大,通常数据量多些的就是几千条,当全部列出数据时速度也不慢,就是按条件搜索时就慢了,请问是不是跟like有关啊,但以前用access蛮快的啊,也建立了索引了 ......
我用("insert into LM_info ([content],[date],[username]) values ('"&content&"',date(),'"&username&"')")
是错误的。
但是我用getdat ......
我正在做一个排行榜表(T_hist)
表内有 qid(外键) 日排行榜(dhits) 周排行榜(whits) 月排行榜(mhits) 总排行榜(hits) 都是int类型
我现在想做个触发器 每日零点把所有行的dhits字段清 ......