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

SQL替换指定列字符串

 -- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE replaceStr
-- Add the parameters for the stored procedure here
@keywords varchar(max),@afterwords varchar(max)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
declare @word varchar(max);
declare @rowcount int;
declare @count int;
set @count = 1;
-- Insert statements for procedure here
begin try
begin tran replaceStr
select @rowcount = count(*) from Logfile;
while @count <= @rowcount
begin
select @word = lcontent from Logfile where lid = @count; --lcontent列名,Logfile表名,lid自增长主键
update Logfile set lcontent = replace(@word,@keywords,@afterwords) where lid = @count;
set @count = @count + 1;
end
commit tran
end try
begin catch
rollback tran
end catch
END
GO


相关文档:

在做SQL故障转移群集的时候应该选择哪种模式?

如果我们的SQL Server要保证高可用性,那么可以采用故障转移群集。最简单的故障转移群集是两台服务器,一台做活动的服务器,另一台做备用服务器,这就是AP模式的Cluster。另外一个模式就是AA模式,也就是两台服务器都是运行SQL Server实例。
SQL Server不像Oracle一样有RAC,所以不可能说两台服务器同时运行同一个实例,想 ......

避免SQL注入和特殊字符的一种方法

 递归小谈自备C#辅助函数
十08
避免SQL注入和特殊字符的一种方法
C#Add comments
避免SQL注入和特殊字符的办法有很多,不同数据库也有不同数据库的解决方案,ADO.NET中使用DbCommand.Parameters解决这个问题,为了了解他的原理,我查了一下.NET中SQLCommand的源代码和MySQL.NET中MySQLCommand的源代码。
.NET源代 ......

解决安装SQL Server2000 文件挂起

      1.不用退出SQL2000安装程序,直接切换到桌面.
  2.打开注册表编辑器(在“运行”中敲入“regedit”之后回车即可),定位到注册表的HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager节点.
  3.单击“Session Manager”这个节点, ......

SQL Server2005 Synonym的使用

--> Title  : SQL Server2005 Synonym的使用
--> Author : wufeng4552
--> Date   : 2009-10-30
1.Synonym的概念
   Synonym(同义词)是SQL Server 2005的新特性。可以简单的理解Synonym为其他對象的别名。
語法
CREATE SYNONYM [ schema_name_1. ] synonym_name FOR & ......

[转]SQL截取字符串

SUBSTRING
返回字符、binary、text      或      image      表达式的一部分。有关可与该函数一起使用的有效      Microsoft®      SQL      Server ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号