34,594
社区成员
发帖
与我相关
我的任务
分享
use master
go
IF db_id('ttt')IS NULL
CREATE DATABASE ttt
go
USE ttt
go
IF OBJECT_ID('T_News','u')IS NULL
CREATE TABLE T_News
(
ID int not null ,
Title varchar(50) not null,
passwd varchar not null
)
if exists(select * from sys.databases where name='ttt')
print '数据库已经存在'
else
create database ttt
go
use ttt
go
if exists(select * from sys.objects where name='T_News' and type ='U')
print '该表已经存在于ttt数据库'
else
create table T_News(ID int not null,Title varchar(50) not null,passwd varchar not null)
go
use master
go
if exists(select * from sysdatabases where name='ttt')
begin
print '已经存在'
end
else
begin
--use master
--go
create database ttt
--go
--use ttt
if exists(select * from sysobjects where name='T_News' and xtype ='U')
begin
print '该表已经存在'
end
else
begin
create table T_News (
ID int not null ,
Title varchar(50) not null,
passwd varchar not null
)
end
end
要去掉四行才执行.