摘要: /***************输入一个参数********************/declare @sql Nvarchar(1000)declare @tt intdeclare @t1 intset @t1=55;--set @sql=N' insert into @ab select 2'exec sp_executesql N'select @t2' --执行的语句,若是变量的话,只可以是Nvarchar变量 ,N'@t2 int' --声明执行语句内的参数,若是变量的话,只可以是Nvarchar变量 ,@t2=@t1 --为语句内的 阅读全文
posted @ 2012-04-13 11:22 slc 阅读(1727) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2012-04-13 10:07 slc 阅读(25479) 评论(0) 推荐(6) 编辑