易截截图软件、单文件、免安装、纯绿色、仅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习题2

 第十一题:
有表students(name,class,grade),请用标准sql语句完成
name class grade
张三 数学 81
李四 语文 70
王五 数学 90
张三 语文 60
李四 数学 100
王五 语文 90
王五 英语 81
要求: 用sql语句输出各门功课都大于80分的同学姓名?
create table students (
name varchar(25),
class varchar(25), ......

sql存储过程

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

IIS与SQL服务器安全加固详解(转)

 
IIS Web服务器安全加固步骤:
步骤 安装和配置 Windows Server 2003。
注意:
1.将\System32\cmd.exe转移到其他目录或更名;
2.系统帐号尽量少,更改默认帐户名(如Administrator)和描述,密码尽量复杂;
3.拒绝通过网络访问该计算机(匿名登录;内置管理员帐户;Support_388945a0;Guest;所有非操作系统服 ......

sql查询表中字段不重复

方法一:
 select distinct name from tablename
方法二:
select min(fid),name,sex from tablename group by name
总计:
select distinct name from tablename 打开重复记录的单个字段
select * from tablename where fid in(Select min(fid) from tablename group by name)打开重复记录的所有字段值
select ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号