摘要: 執行字符串 sql==SET @SqlStr=N'delete from '+@batchdataTable+' where exists( select 1 from csps_batch t2 where batchid =t2.batchid and t2.lupdtime <=convert(datetime,'''+@dBefHusrKp+''',103) and status in (''A'',''D''))'; --select 阅读全文
posted @ 2011-06-10 10:40 左安 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 查詢所有含有active 字段的log表===select table_name from information_schema.COLUMNS where COLUMN_NAME='active' and TABLE_CATALOG =(select TABLE_CATALOG from csps_system_param where pname='TABLE_CATALOG') and table_name like 'log%' 阅读全文
posted @ 2011-06-10 10:35 左安 阅读(204) 评论(0) 推荐(0) 编辑
摘要: SQL:通過function創建臨時表function作用:通過分隔符將字符串分割插入臨時表中。========ALTER function [dbo].[fn_splitStr](@str varchar(8000), @split varchar(10)) returns @t table(col varchar(100),rownum int identity(1,1)) as begin declare @splitLen int set @splitLen=len(@split) - 1 while charindex(@split, @str)>0 begin insert 阅读全文
posted @ 2011-06-10 10:27 左安 阅读(246) 评论(0) 推荐(0) 编辑