易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL server 2000 如何判断临时表是否存在


 
 
1.判断一个临时表是否存在
if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempcitys') and type='U')
   drop table #tempcitys
注意tempdb后面是两个. 不是一个的
---临时表
if exists(select * from tempdb..sysobjects where name like ‘#tmp1%‘)
drop table #tmp1

if exists( select * from tempdb..sysobjects where id=OBJECT_ID('tempdb..#tmp') )
drop table #tmp1
--视图
if exists (select * from sysobjects where id = object_id(N‘[dbo].[ESTMP]‘)
and OBJECTPROPERTY(id, N‘IsView‘) = 1)
  drop view ESTMP
判断表是否存在
if exists (select * from sysobjects where id = object_id(N'[dbo].[phone]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[phone]


相关文档:

用ADO管理SQL SERVER !

      在软件开发中,常常需要为程序建立Sql Server数据库的运行环境。完成如在SQL Server数据库中建立设备,建立数据库,建立表格,分配权限等功能,如何方便的建立应用程序所需Sql Server环境的数据库环境,而不用启动SQL Enterprise Manager呢?
下面来看: 
  启动VB6.0,新建一个工 ......

VB实现SQL Server数据库备份/恢复

VB实现SQL Server数据库备份/恢复
http://blog.csdn.net/cncco/archive/2006/05/15/729356.aspx
’**模 块 名:fBackupDatabase_a
’**描    述:备份数据库,返回出错信息,正常恢复,返回""
’**调    用:fBackupDatabase_a "备份文件名","数据库名"
’**参数说明� ......

防SQL数字注入函数

防SQL数字注入函数
http://blog.csdn.net/cncco/archive/2007/10/03/1810540.aspx
防SQL注入函数
程序代码:
函数部分========================================================================
'------------------------------------------------
'用途:检查是否为数字,以及数字是否超出范围
'输入:检查字符,� ......

SQL存储过程入门 南三方

一、SQL存储过程的概念,优点及语法 
  整理在学习程序过程之前,先了解下什么是存储过程?为什么要用存储过程,他有那些优点
  定义:将常用的或很复杂的工作,预先用SQL语句写好并用一个指定的名称存储起来, 那么以后要叫数据库提供与已定义好的存储过程的功能相同的服务时,只需调用execute,即可自动完成命令 ......

sql语句

/*获取重复记录中较小的那个ID*/ create table tmp_Repeat as  select  min(id) as id from poi group by idcode having count(*) >1; /*备份删除的数据*/ select * from poi where id in (select id from tmp_repeat) /*删除重复记录中ID较小的那条
select replace('阿桂是个好孩子','阿桂','小贤') from du ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号