1. create table b (code int identity(1,1) NOT NULL ,name char(2)) select name into b(name) from a
update b set name_b=name_a from a,b where a.no1=b.no2
2. uptate b set name_b=a.name_a from a where b.no2=a.no1
--2.update 表 set col=substring(replace(','+col+',',',1,',',2,'),2,len(replace(','+col+',',',1,',',2,'))-2) where charindex(',1,',','+col+',')>0
3. update t set col=substring(replace(','+col+',',',1,',',2,'),2,len(col))
','+col+',' 为什么要加上两个“,”号? update 表 set col=substring(replace(col,',1',',2'),1,len(replace(col,',1',',2'))) where charindex(',1',col)>0 这样不行吗? 再就是还有,第一个问题 如果用 a1n1(阿贵) 的方法: create table b (code int identity(1,1) NOT NULL ,name char(2)) select name into b(name) from a 执行后,会提示: 'name' 附近有语法错误。 所以说,是不是应该不能这样写? 如何写呢? 请出手吧。。
create table b (code int identity(1,1) NOT NULL
,name char(2))
select name into b(name) from a
update b set name_b=name_a
from a,b
where a.no1=b.no2
uptate b set name_b=a.name_a from a where b.no2=a.no1
where charindex(',1,',','+col+',')>0
update t set col=substring(replace(','+col+',',',1,',',2,'),2,len(col))
为什么要加上两个“,”号?
update 表 set col=substring(replace(col,',1',',2'),1,len(replace(col,',1',',2')))
where charindex(',1',col)>0
这样不行吗?
再就是还有,第一个问题
如果用 a1n1(阿贵) 的方法:
create table b (code int identity(1,1) NOT NULL
,name char(2))
select name into b(name) from a
执行后,会提示:
'name' 附近有语法错误。
所以说,是不是应该不能这样写?
如何写呢?
请出手吧。。
谢谢邹老大!
接分,