我需要 Sybase 数据类型来保存不确定长度的字符串. [英] I need Sybase datatype to save string of indefinite Length.
本文介绍了我需要 Sybase 数据类型来保存不确定长度的字符串.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的要求是声明一个接受最大大小的xml值的数据类型.
问题:我们在 Sybase 中有 text、xml 或 varchar(max) 数据类型吗?
My requirement is to declare a datatype which accepts xml value with maximum size.
Question: Do we have text, xml or varchar(max) datatype in Sybase?
推荐答案
有文本数据类型.您可以找到更多信息 这里.
There is text datatype. You can find More information here.
如何在程序中使用它:
create procedure settxt
(
@txt text
)
as
begin
select @txt
end
如何运行程序:
declare @txt text
select @txt = 'Hello world'
execute settxt @txt
代码对我有用,但可能不适合所有人.
The code works for me, but maybe not for everyone.
这是临时表的解决方案:
Here is solution with temporary table:
create table #texttab
(
txt varchar(100)
)
go
insert into #texttab
values ('Hello ')
insert into #texttab
values (' wolrd!')
go
create procedure settxt
as
begin
declare @txt text,
@txtval varchar(100)
select @txt=' '
declare curTXT cursor for
select txt from #texttab
open curTXT
fetch curTXT into @txtval
while @@sqlstatus=0 begin
select @txtval
select @txt=@txt+@txtval
select @txt
fetch curTXT into @txtval
end
close curTXT
deallocate cursor curTXT
select @txt
end
go
execute settxt
这篇关于我需要 Sybase 数据类型来保存不确定长度的字符串.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文