if not exists(select * from sys.objects where name='wc')--检测数据库是否存在,若不存在,则创建wc数据库
create database wc
go
use wc
go
if object_id('xxdd') is not null --检查表xxdd是否存在,如果存在删除该表
drop table xxdd
go
create table xxdd
(aa int,
bb int,
cc int,
dd int,
ff int)
go
--go 的特殊用法
select * from xxdd
insert into xxdd values(1,2,3,4,5,6)
go 10 --批处理执行10次,也就是说表xxdd中会有10条数据,go后面一定要是整数,go前面不能带任何sql语句
select * from xxdd
--top的特殊用法
delete top (3) from xxdd --删除xxdd的前三条信息
update top (3) xxdd set cc=99 --更新前3条记录,将大量数据分成若干小的组成部分,然后分批更新
了解更多关于软件方面的知识,请访问上海软件培训学校