易截截图软件、单文件、免安装、纯绿色、仅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语句导入导出大全
/*******  导出到excel
EXEC master..xp_cmdshell ’bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"GNETDATA/GNETDATA" -U"sa" -P""’
/***********  导入Excel
SELECT *
from OpenDataSource( ’Microsoft.Jet.OLEDB.4.0’,
  ’Data Source="c:\test.xls ......

SQL Server 数据库优化方法 (一)

  我经常碰到有人会问一些数据库优化方面的问题,我觉得这是一最基本技能要求,特别是使用sql server 2005,对于sql server的优化,使用的专职dba或兼职dba们工作更轻松,效率更高了,但是还是有很多新人可能不大了解,我在这儿写一下最基本的一些介绍。
  一、首先介绍一下sql server 2005中优化数据时使用到的两个工 ......

这样的sql,我却做到了。

 这是一个CSDN Oracle开发版块里,网友问过的一道题
题如下
create table A_TEST
(
PAYOUT_ITEM_CODE VARCHAR2(30) not
null,
FORMULA_DET VARCHAR2(1000)
)
create table B_TEST
(
ELEMENT_ID VARCHAR2(5) not null,
NAME VARCHAR2(41)
)  
求写oracle多个字符替换(有测试数据)
inser ......

SQL中DATEADD和DATEDIFF的用法

固定日期减一个月(日、年)
dateadd(表达式1,表达式2,表达式3)
表达式1为MM或YY或DD
表达式2为1
表达式3为要减的日期 一个月的第一天 第一个例子,我将告诉你如何从当前日期去这个月的最后一天。请注意:这个例子以及这篇文章中的其他例子都将只使用DATEDIFF和DATEADD函数来计算我们想要的日 ......

sql存储过程语法

 
一.注释
  -- 单行注释,从这到本行结束为注释sql 语法,类似C++,c#中//
  /* … */ 多行注释,类似C++,C#中/* … */

二.变量(int, smallint, tinyint, decimal,float,real, money ,smallmoneysql 语法, text ,image, char, varchar。。。。。。)
语法:
DECLARE
&nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号