创建数据库 创建之前判断该数据库是否存在 if exists (select * from sysdatabases where name=databasename) drop database databasename go create database database-name 删除数据库 drop database dbname 备份sql server --- 创建备份数据的 device use master exec sp_addumpdevice disk, testback, c:\mssql7backup\mynwind_1
dat --- 开始备份 backup database pubs to testback 创建新表 create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],
) 根据已有的表创建新表: a:go use 原数据库名 go select * into 目的数据库名
目的表名 from 原表名(使用旧表创建新表) b:create table tab_new as select col1,col2
from tab_old definition only 创建序列 create sequence simon_sequence minvalue 1 -- 最小值 maxvalue 999999999999999999999999999 -- 最大值 start with 1 -- 开始值 increment by 1 -- 每次加几 cache 20; 删除新表 drop table tabname 增加一个列 alter table tabname add colname coltype 删除一个列 alter tabl