All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
C#生成中文汉字验证码源码_.net资料_编程技术
C#,3.0新特性初步研究,Part4:使用集合类型初始化器_[Asp.Net教程]
C#教程:拖放技术的典型应用实例
Delphi项目的框架类-TApplication类实例-详解
SQL,Artisan多层查询条件嵌套功能_[SQL,Server教程]
SQL里的cast和convert_[SQL,Server教程]
C#中使用SQL,Server分布式管理对象(SQL
asp.net,2.0,下的表单验证Cookieless属性_.net资料_编程技术
人工生命—群集智能—蚁群算法js版_JavaScript技术_编程技术
visual c++中虚基类的用法
Reading number is top 10 pictures
Startling Russian girl blind date scene3
男人巳快沦落成动物了
史上最大的哺乳动物迁移
NeedWallpaper6
Distribution of wealth in China survey status report
The sixties of the last century, China is such a kill pig
Sora aoi on twitter4
Hunan province aizhai super-large suspension bridge open to traffic and 4 world first1
China telecom 114 spokesman MeiYanXu1
谁认识这位校花
Download software ranking
Boxer's Top ten classic battle1
Sora aoi, the maid, students' uniforms
SQL2000 For 4IN1
Such love down(擒爱记)
Tram sex maniac 2 (H) rar bag13
Eclipse 4.2.1 For Win32
圣殿祭司的ASP.NET.2.0.开发详解-使用C#
传奇私服架设教程
Boxer's Top ten classic battle7
XML+Web+Service开发教程
归海一刀 published in(发表于) 2014/2/3 6:39:39 Edit(编辑)
SQL判断是否存在_[SQL Server教程]

SQL判断是否存在_[SQL Server教程]

SQL判断是否存在_[SQL Server教程]
--判断数据库是否存在
if exists(select * from master..sysdatabases where name=N’库名’)
print ’exists’
else
print ’not exists’

---------------
-- 判断要创建的表名是否存在
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[表名]’) and OBJECTPROPERTY(id, N’IsUserTable’) = 1)
-- 删除表
drop table [dbo].[表名]
GO

---------------
--判断要创建临时表是否存在
If Object_Id(’Tempdb.dbo.#Test’) Is Not Null
Begin
print ’存在’
End
Else
Begin
print ’不存在’
End

---------------
-- 判断要创建的存储过程名是否存在
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[存储过程名]’) and OBJECTPROPERTY(id, N’IsProcedure’) = 1)
-- 删除存储过程
drop procedure [dbo].[存储过程名]
GO

---------------
-- 判断要创建的视图名是否存在
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[视图名]’) and OBJECTPROPERTY(id, N’IsView’) = 1)
-- 删除视图
drop view [dbo].[视图名]
GO

---------------
-- 判断要创建的函数名是否存在
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[函数名]’) and xtype in (N’FN’, N’IF’, N’TF’))
-- 删除函数
drop function [dbo].[函数名]
GO

if col_length(’表名’, ’列名’) is null
print ’不存在’

select 1 from sysobjects where id in (select id from syscolumns where name=’列名’) and name=’表名’


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.