create function getAllTableNameProc(@xtype char(1))
returns varchar(8000)
as
begin
declare @content varchar(8000),@temp varchar(50)
set @content = '' --declare cur_sj cursor for
--Select name FROM SysObjects Where XType=@xtype ORDER BY Name
--open cur_sj
--fetch cur_sj into @temp
--while @@fetch_status=0
--begin
--set @content = @content + @temp + ','
--fetch cur_sj into @temp
--end
--close cur_sj
--deallocate cur_sj Select @content = @content+name+',' FROM SysObjects Where XType=@xtype ORDER BY Name return @content
end注:sql2000
因不支持text类型变量,只有使用varchar(8000),但实际环境中返回的内容长度要比这个长的多的多(当然我可以返回一个结果集在程序中再去处理)。但我想在其它的sql语句中调用这个函数(能够直接拿到数据因此这个函数必须返回格式如下:one,two,three,……),应该如何做呢?请高手给解答。谢谢。
returns varchar(8000)
as
begin
declare @content varchar(8000),@temp varchar(50)
set @content = '' --declare cur_sj cursor for
--Select name FROM SysObjects Where XType=@xtype ORDER BY Name
--open cur_sj
--fetch cur_sj into @temp
--while @@fetch_status=0
--begin
--set @content = @content + @temp + ','
--fetch cur_sj into @temp
--end
--close cur_sj
--deallocate cur_sj Select @content = @content+name+',' FROM SysObjects Where XType=@xtype ORDER BY Name return @content
end注:sql2000
因不支持text类型变量,只有使用varchar(8000),但实际环境中返回的内容长度要比这个长的多的多(当然我可以返回一个结果集在程序中再去处理)。但我想在其它的sql语句中调用这个函数(能够直接拿到数据因此这个函数必须返回格式如下:one,two,three,……),应该如何做呢?请高手给解答。谢谢。
identity生成一行号