交叉制表--檢查列的計(jì)數(shù)值和長度并加入行數(shù)據(jù)(9) 交叉表 --除了需要證實(shí)列的計(jì)數(shù)值和名稱長度,如果一切正常用戶還需要填寫#rownames表--check column countif (select count(*) from #colnames)1023begin drop table #colnames raiserror 51004 'distinct co
交叉制表--檢查列的計(jì)數(shù)值和長度并加入行數(shù)據(jù)(9)--除了需要證實(shí)列的計(jì)數(shù)值和名稱長度,如果一切正常用戶還需要填寫#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)
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com