SQL SERVER的表有没有类似ACCESS的MEMO字段?

leelekwei 2003-11-19 11:36:45
用来储存大量文字记录,用什么类型的字段比较好?
...全文
137 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bullHEcow 2003-12-03
  • 打赏
  • 举报
回复
up
leelekwei 2003-11-19
  • 打赏
  • 举报
回复
我的table , 原来用的是nvarchar字段类型, 已经有数据在里面,后来转为ntext以后,发现里面的数据还在,但是在网页中用response.write(rst("xx"))就不能把数据读出来。

大家帮忙帮到底,看看如何解决?
zjcxc 元老 2003-11-19
  • 打赏
  • 举报
回复
create table hello(id int identity(1,1),CONTENT text)
insert into hello
select '<IMG align=baseline alt="" border=0 src="http://localhost/upimg/0335_p1.jpg"><BR>'
union all select '<IMG align=baseline alt="" border=0 src="http://localhost/upimg/0335_p1.jpg"><BR>'

--定义替换/删除的字符串
declare @s_str varchar(8000),@d_str varchar(8000)
select @s_str='http://localhost/' --要替换的字符串
,@d_str='' --替换成的字符串

--定义游标,循环处理数据
declare @id int
declare #tb cursor for select id from hello
open #tb
fetch next from #tb into @id
while @@fetch_status=0
begin
--字符串替换处理
declare @p varbinary(16),@postion int,@rplen int
select @p=textptr(CONTENT),@rplen=len(@s_str),@postion=charindex(@s_str,CONTENT)-1 from hello where id=@id
while @postion>0
begin
updatetext hello.CONTENT @p @postion @rplen @d_str
select @postion=charindex(@s_str,CONTENT)-1 from hello where id=@id
end

fetch next from #tb into @id
end
close #tb
deallocate #tb

--显示结果
select * from hello

--删除数据测试环境
drop table hello
zjcxc 元老 2003-11-19
  • 打赏
  • 举报
回复
text字段.
pengdali 2003-11-19
  • 打赏
  • 举报
回复
字符串
char

固定长度的非 Unicode 字符数据,最大长度为 8,000 个字符。

varchar

可变长度的非 Unicode 数据,最长为 8,000 个字符。

text

可变长度的非 Unicode 数据,最大长度为 2^31 - 1 (2,147,483,647) 个字符。

Unicode 字符串
nchar

固定长度的 Unicode 数据,最大长度为 4,000 个字符。

nvarchar

可变长度 Unicode 数据,其最大长度为 4,000 字符。sysname 是系统提供用户定义的数据类型,在功能上等同于 nvarchar(128),用于引用数据库对象名。

ntext

可变长度 Unicode 数据,其最大长度为 2^30 - 1 (1,073,741,823) 个字符。

pengdali 2003-11-19
  • 打赏
  • 举报
回复
text

34,875

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧