W3CHINA Blog首页    管理页面    写新日志    退出


«December 2025»
123456
78910111213
14151617181920
21222324252627
28293031

 

公告

Back Today!

Hold on~ 

Come on~

最新日志

正规判断email
文件md5值
javascript:操作url参数的函
C#淡出淡入窗体
VSS 6 admin用户的密码破解
没用过的东东(sql)
初学ajax(C#)
页面开发的准则一
textbox忽略html验证
这点破东东,老是记不住,nnd!

最近的评论

回复:初学ajax(C#)
回复:C#淡出淡入窗体
回复:ivr的部分动作
回复:textbox忽略html验证
回复:VSS 6 admin用户的密码破
回复:VSS 6 admin用户的密码破
回复:VSS 6 admin用户的密码破
回复:VSS 6 admin用户的密码破
回复:excel中的工作表名sheetn
回复:VSS 6 admin用户的密码破

连接




专题

首页(39)
IVR(4)
SQLSERVER(12)
AJAX(0)
.net(13)
小技巧(4)
english(2)

留言

签写新留言

请教

统计

blog名称:执著
日志总数:39
评论数量:43
留言数量:0
访问次数:247576
建立时间:2005年3月4日

[SQLSERVER]sqlserver查找txt文件中指定格式
执著 发表于 2005/4/6 17:33:53

ALTER         proc input_text@file varchar(200) = 'E:\a12.txt',@format varchar(50) ='%13[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%',@formatlength int = 11as if exists(select * from tempdb.dbo.sysobjects where name = '##text' and xtype = 'U')begin drop table ##textend create table ##text(Col001 nvarchar(4000)) declare @start int declare @cmd varchar(1000)set @cmd = 'bcp ##text in ' + @file + ' -c -P'exec master..xp_cmdshell @cmd if @format = '%' insert into text(filename,body) select @file,ltrim(rtrim(Col001)) from ##textelsebegin  declare @len int declare @text nvarchar(4000) declare cur_findword cursor scroll for select Col001 as Col001 from ##text open cur_findword  fetch next from cur_findword into @text  while @@fetch_status = 0 begin  while patindex(@format,@text) != 0  begin   set @len = len(@text)   insert into text(filename,body) values(@file,substring(@text,patindex(@format,@text),@formatlength))   set @text = substring(@text,patindex(@format,@text)+@formatlength,@len)  end   fetch next from cur_findword into @text end  close cur_findword DEALLOCATE cur_findwordend

阅读全文(3962) | 回复(1) | 编辑 | 精华


发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



 

 

 


站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.031 second(s), page refreshed 144804842 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号