摘要: --判断数据库是否存在 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 -- 阅读全文
posted @ 2011-03-02 22:47 晓风拂月 阅读(209) 评论(0) 推荐(0) 编辑
摘要: --这个是截取字符串的函数,在生成存储过程的时候调用了gocreate function [dbo].[f_split](@SourceSql varchar(max),@StrSeprate varchar(10)) returns @temp table(Rowvalue varchar(1000))as begin declare @i int set @SourceSql=rtrim(ltrim(@SourceSql)) set @i=charindex(@StrSeprate,@SourceSql) while @i>=1 begin insert @temp values(l 阅读全文
posted @ 2011-03-02 22:28 晓风拂月 阅读(2369) 评论(0) 推荐(0) 编辑