一个离开.NET的程序员

ryhan

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年11月4日

摘要: 一.OBJECT_ID返回数据库对象标识号。语法OBJECT_ID ( 'object' )例如:USE masterSELECT OBJECT_ID('pubs..authors')查看pubs数据库里的authors表的object_id。二.OBJECTPROPERTY返回当前数据库中对象的有关信息。语法OBJECTPROPERTY ( id , property )例如:OBJECTPROPERTY ( object_id('authors'),'ISTABLE') = 1判断authors对象是否是一个表。在查询器里输入 阅读全文
posted @ 2011-11-04 10:24 ryhan 阅读(293) 评论(0) 推荐(0) 编辑

摘要: 源:http://www.jiaonan.tv/html/blog/1/27227.htm1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名]2 判断表是否存在Sql代码 if exists (select * from sysobjects where id = object_id(... 阅读全文
posted @ 2011-11-04 10:23 ryhan 阅读(356) 评论(0) 推荐(0) 编辑