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 #
相关文档:
and exists (select * from sysobjects) //判断是否是MSSQL and exists(select * from tableName) //判断某表是否存在..tableName为表名 and 1=(select @@VERSION) //MSSQL版本 And 1=(select db_name()) //当前数据库名 and 1=(select @@servername) //本地服务名 and 1=(select IS_SRVROLEMEMBER('sysadmin')) ......
第一题:
为管理业务培训信息,建立3个表:
S(S#,SN,SD,SA)S#,SN,SD,SA分别代表学号,学员姓名,所属单位,学员年龄
C(C#,CN)C#,CN分别代表课程编号,课程名称
SC(S#,C#,G) S#,C#,G分别代表学号,所选的课程编号,学习成绩
(1)使用标准SQL嵌套语句查询选修课程名称为’税收基础’的学员学号和姓名?
(2) 使 ......
CREATE PROCEDURE
创建存储过程,存储过程是保存起来的可以接受和返回用户提供的参数的 Transact-SQL 语句的集合。
可以创建一个过程供永久使用,或在一个会话中临时使用(局部临时过程),或在所有会话中临时使用(全局临时过程)。也可以创建在 Microsoft? SQL Server? 启动时自动运行的存储过程。
语法
CREATE ......
.NET中C#的byte关键字映射.NET的Byte结构:表示一个 8 位无符号整数。Byte 值类型表示值介于 0 和 255 之间的无符号整数。
.NET中C#的short关键字映射.NET中的Int16:有符号 16 位整数,-32,768 到 32,767。
SQL SERVER中的tinyint:从 0 到 255 的整型数据。存储大小为 1 字节。
sbyte:存储8位带符号整数。sbyt ......
IIS Web服务器安全加固步骤:
步骤 安装和配置 Windows Server 2003。
注意:
1.将\System32\cmd.exe转移到其他目录或更名;
2.系统帐号尽量少,更改默认帐户名(如Administrator)和描述,密码尽量复杂;
3.拒绝通过网络访问该计算机(匿名登录;内置管理员帐户;Support_388945a0;Guest;所有非操作系统服 ......