同一数据库复制表为
select * into ls1 from ls2
如果我想把数据库a的表ls1复制到b的数据库ls2(ls2本来不存在)还有一个小问题怎么用查询分析器中将表ls1中id中的编号去掉左边第一位
如
id
015
078
099
135
我想得到
id
15
78
99
35
select * into ls1 from ls2
如果我想把数据库a的表ls1复制到b的数据库ls2(ls2本来不存在)还有一个小问题怎么用查询分析器中将表ls1中id中的编号去掉左边第一位
如
id
015
078
099
135
我想得到
id
15
78
99
35
if object_id('tempdb.dbo.#T1') is not null drop table #T1
create table #T1 (id varchar(11))
insert into #T1
select '015' union all
select '078' union all
select '099' union all
select '135'select id from #T1select id=right(id,len(id)-1) into #T2 from #T1select * from #T2/*
id
-----------
15
78
99
35
*/
select stuff(id,1,1,'') as id from ls1
select substring(id,2,len(id)-1) from ls1