摘要: 1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名]2 判断表是否存在Sql代码 if exists (select * from sysobjects where id = object_id(N’[表名]’) and OBJECTPROPERTY(id, N’IsUserTable’) = 阅读全文
posted @ 2011-02-24 16:36 catch22 阅读(840) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.cnblogs.com/kerrycode/archive/2010/08/05/1792671.html动态SQL:code that is executed dynamically。它一般是根据用户输入或外部条件动态组合的SQL语句块。动态SQL能灵活的发挥SQL强大的功能、方便的解决一些其它方法难以解决的问题。相信使用过动态SQL的人都能体会到它带来的便利,然而动态SQL有时候在执行性能(效率)上面不如静态SQL,而且使用不恰当,往往会在安全方面存在隐患(SQL 注入式攻击)。动态SQL可以通过EXECUTE 或SP_EXECUTESQL这两种方式来执行。(来 阅读全文
posted @ 2011-02-24 13:19 catch22 阅读(285) 评论(0) 推荐(0) 编辑