您好,欢迎来到纷纭教育。
搜索
您的当前位置:首页交叉制表--检查列的计数值和长度并加入行数据(9)

交叉制表--检查列的计数值和长度并加入行数据(9)

来源:纷纭教育


交叉制表--检查列的计数值和长度并加入行数据(9) 交叉表 --除了需要证实列的计数值和名称长度,如果一切正常用户还需要填写#rownames表--check column countif (select count(*) from #colnames)1023begin drop table #colnames raiserror 51004 'distinct co

交叉制表--检查列的计数值和长度并加入行数据(9)
交叉表 $velocityCount-->
--除了需要证实列的计数值和名称长度,如果一切正常用户还需要填写#rownames表
--check column count
if (select count(*) from #colnames)>1023
begin
 drop table #colnames
 raiserror 51004 'distinct column count exceeded max of 1023'
 return -1
end
--verify colnames do not exceed max length
if (select max(datalength(rtrim(colname))-1) from #colnames)>29
begin
 drop table #colnames
 raiserror 51050 'column data length exceeded max of 30'
 return -1
end
--if all is ok ,continue to add #rownames data
select @chvexec='insert #rownames select distinct '+
 case @introwtype
 when 1 then 'convert(varchar(255),' else ''
 end +rtrim(@chrrowhead)+
 case @introwtype
 when 1 then ')'
 else ''
 end +'from '+@chrsource
--print @chvexec
exec(@chvexec) 

Copyright © 2019- fenyunshixun.cn 版权所有 湘ICP备2023022495号-9

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务