-- 建表 create table tb1(col varchar(1000)); insert into tb1 values('12345678901112131415161718192021222324252627282930'); insert into tb1 values('abcdefghijklmnopqrstuvwxyzfdsaklfdjsaklfjdsaklfj');create table tb2(col varchar(50)); select * from tb1-- 插入第二张表数据的sql ;with t as( select vt = substring(col,5+1, len(col)), st = left(col, 5) from tb1 union all select vt = substring(t.vt,5+1, len(t.vt)), st = left(t.vt, 5) from t where len(t.vt)>0 ) insert into tb2 select st from t
-- 建表
create table tb1(col varchar(1000));
insert into tb1 values('12345678901112131415161718192021222324252627282930');
insert into tb1 values('abcdefghijklmnopqrstuvwxyzfdsaklfdjsaklfjdsaklfj');create table tb2(col varchar(50));
select * from tb1-- 插入第二张表数据的sql
;with t as(
select
vt = substring(col,5+1, len(col)),
st = left(col, 5)
from tb1
union all
select
vt = substring(t.vt,5+1, len(t.vt)),
st = left(t.vt, 5)
from t
where len(t.vt)>0
)
insert into tb2
select st from t