木子屋 Dnawo's BLOG

判断MSSQL表/存储过程/视图是否存在

👤 dnawo 📅 2009-09-29 👁 6341 👍 0 💬 0 🔄 本站原创
1).判断用户表是否存在

if exists (select top 1 * from sysobjects where id = object_id(N'[所有者.]表名') and type='U')

2).判断临时表是否存在

if object_id('tempdb..##temp') is not null

3).判断存储过程是否存在

if exists (select top 1 * from sysobjects where id=object_id('[所有者.]存储过程名') and type='P') 

4).判断视图是否存在

if exists (select top 1 * from sysobjects where id=object_id('[所有者.]视图名') and type='V')

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 VB6.0 Dictionary排序 下一篇 → 淘宝网开放平台回调参数top_parameters说明