易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Server TEXT类型字段字符串替换示例处理脚本

 /*--text字段的替换处理  
  --*/  
  --创建数据测试环境  
--create   table   #tb(aa   text)
declare @s_str varchar(8000),@d_str varchar(8000),  --定义替换的字符串 
        @p varbinary(16),@postion int,@rplen int,@i_Start int, @i_End int
select identity(int,1,1) as [id],newsid into # from news
select @i_Start=min([id]),@i_End=max([id]) from #
while (@i_Start<=@i_End)
begin 
  --insert into #tb(aa) select content from # where [id]=@i_Start
  select   @s_str='\'   --要替换的字符串  
  ,@d_str='!' --替换成的字符串     
  --字符串替换处理       
  select   @p=textptr(content),@rplen=len(@s_str),@postion=charindex(@s_str,content)-1 from news where newsid in (select top 1 newsid from # where [id]=@i_Start) 
  while   @postion>0  
  begin  
    updatetext   news.content   @p   @postion   @rplen   @d_str  
    select   @postion=charindex(@s_str,content)-1  from news where newsid in (select top 1 newsid from # where [id]=@i_Start)
  end 
  --truncate table #tb
 
  select @i_Start=@i_Start+1
end
 
--删除数据测试环境  
--drop   table   #tb 
drop table #


相关文档:

sql 2005 存储过程分页 java 代码

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列 ......

SQL流水号生成语句

table
     
        Num        createDate
---------------------------------
      (空)          20090901
      (空)          20090901
      ......

ms sql 更新表A中某列为表B中的值


ms sql 更新表A中某列为表B中的值
select *
from dbo.NT_areapin
go
select *
from dbo.NT_dict_area
update NT_areapin
set AllNamePin='PengShui'
from NT_areapin
where AreaId='486'
go
update NT_dict_area
set BriefNamePin = NT_areapin.BriefNamePin,AllNamePin = NT_areapin.AllNamePin
from N ......

sql存储过程

 在ASP.Net项目中使用存储过程,首先可以提高数据库的安全性,其次可以提高运行SQL代码运行的速度,在大型项目中一般是必不可少的。Visual Studio.Net为SQL的存储过程提供了强大的支持,您既可以通过visual studio.net来新建存储过程,也可以直接在Sql Server的查询分析器中运行,还可以通过企业管理器创建,使用起来也 ......

Oracle SQL Trace使用实例

为了研究一下系统在后台都干了什么,当然是我在代码里没找到的情况下,研究了一下trace,结果有一定的帮助。oracle中不像sql server中那样直接提供图像化的工具,所以还是得自己动手来做,归纳了一下,步骤如下:
查询session:
SQL> select sid, serial#, username from v$session where username='XXX';//找出你要跟 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号