当前位置: 代码迷 >> Sql Server >> 怎么检测表是否存在
  详细解决方案

怎么检测表是否存在

热度:79   发布时间:2016-04-27 13:01:39.0
如何检测表是否存在
如题。如何检测表是否存在,如果不存在才创建表?

另外,假设存在,如何删除里面的数据??

求解答~

------解决方案--------------------
SQL code
 if object_id('tbname','u') is not null   select 'tbname存在'
------解决方案--------------------
SQL code
if exists(select * from sysobjects where name='table1' and type='u')   delete from table1else   create talbe talbe1   (   )
  相关解决方案