如何检测数据库中某张表是否存在(不一定有数据的)??

xiaoxiongfcl 2005-12-23 05:29:51
如题,检测方式是不是所有数据库都不相同,请分别指点一下
...全文
282 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanyongbinlq 2005-12-30
  • 打赏
  • 举报
回复
都对
lzheng2001 2005-12-28
  • 打赏
  • 举报
回复
用lzp_lrp(lzp)的方法吧,用select 之前用DBHandle ( )来先判断连接是否有效

long ll_cnt
if sqlca.DBHandle() > 0 then
select count(*) into :ll_cnt from 表;
if sqlca.sqlcode = -1 then
messagebox('', '表不存在')
else
//表存在
end if
else
//连接无效
end if
xiaoxiongfcl 2005-12-28
  • 打赏
  • 举报
回复
还有N多数据库呢?
WorldMobile 2005-12-24
  • 打赏
  • 举报
回复

long ll_cnt
select count(*) into :ll_cnt from 表;
if sqlcq.sqlcode = -1 then
messagebox('', '表不存在')
else
//表存在
end if
handycyw 2005-12-24
  • 打赏
  • 举报
回复
ms sqlserver 2000
例子
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[charge_invoice]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[charge_invoice]
lw1a2 2005-12-23
  • 打赏
  • 举报
回复
ASE也可以
jdsnhan 2005-12-23
  • 打赏
  • 举报
回复
oracle 是 select table_name from user_Tables where table_name = 'your table';
xiongxiao 2005-12-23
  • 打赏
  • 举报
回复
ASA中也可以这样
wscft 2005-12-23
  • 打赏
  • 举报
回复
别的不知道
SQL Server 中为
select * from sysobjects where id=object_id(@as_name)
@as_name 可以为表,存储过程, 触发器,视图名称

754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧