新生高分求解!如何用T-SQL语言判断一个数据库已创建? 如何用T-SQL语言判断一个数据库已创建?能给个例子吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from Sys.Databases where name ='yourdbname' use masterif exists(select 1 from sysdatabases where name = '数据库名') print '存在'else print '不存在' if not exists(select 1 from Sys.Databases where name ='yourdbname')create database yourdbname if db_id('test') is not nullprint 1else print 0 IF EXISTS (SELECT * FROM sys.databases WHERE name = 'dbname') ..... if not exists(select 1 from sys.databases where name ='yourdbname')... 大侠们要让楼主知道什么是sys.database,,强烈要求楼主去了解sysdatabase这个在master库中的表。 这是个很基础的东西if exists (select * from sys.objects where object_id = object_id (N'[dbo].[UserInfo]') and type in (N'U') ) 执行dbcc shrinkfile(数据文件)时总是处于执行状态 [重问 附图]求助一个update的问题 拜托大师们了 表字段比较 用SQL语句如何写入系统时间? help-日期有关的SQL sql 2000 临时表怎么样一条语句插入多条数据 怎么实现扩展存储函数! 救救我吧,大虾们,如何在VB6中,调用SQL Server 2000 的导入数据功能来导入Execl的表 SQL Server菜鸟问题……(急) 如何恢复被drop 掉的表(好惨啊!) BULK INTO 批量导入的文件中,列数不一样,如何导入? 一个更新条件问题
if exists(select 1 from sysdatabases where name = '数据库名')
print '存在'
else
print '不存在'
create database yourdbname
if db_id('test') is not null
print 1
else
print 0
.....
...