同一表中的数据写入问题

wertde 2010-08-23 11:19:48
有一数据库,需要把同一表中的DD_001_info bis DD_050_info行的text写入DD_001_input bis DD_050_input行的info,没有ID。请问该如何做。
...全文
56 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
chazikai24 2010-08-24
  • 打赏
  • 举报
回复
update 表 set INFO = (select text from 表 where name ='DD_001_info') where name = 'DD_001_input'
wertde 2010-08-24
  • 打赏
  • 举报
回复
没有完全相同的两行
解决了
update tb set INFO = @text
where ..=replace(..,_input,_..)
jointan 2010-08-24
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 aspwebchh 的回复:]
alter table tb add id int identity 建一个 不就有 id 了

改完后再把列删了

alter table tb drop column id
[/Quote]

这办法不错,改完后实际上也不用删了,多了这么个列基本上不会影响其他程序使用这个表(如果有在另一个表添加行时在触发器上对这个表添加行,并取@@IDENTITY的除外)
挨踢直男 2010-08-24
  • 打赏
  • 举报
回复
alter table tb add id int identity 建一个 不就有 id 了

改完后再把列删了

alter table tb drop column id
jointan 2010-08-24
  • 打赏
  • 举报
回复
where name='DD_001_input' and text='hhhhhhhhhhh' and Info is null

没主键的表,如果有完全相同的两行就没办法了,只能打开企业管理器自己去里面输了
wertde 2010-08-24
  • 打赏
  • 举报
回复
DD_001_info, bis , DD_050_info ,是一列
name text INFO
DD_001_info aaaaaaaaaaa NULL
DD_001_input hhhhhhhhhhh NULL

希望得到
name text INFO
DD_001_info aaaaaaaaaaa NULL
DD_001_input hhhhhhhhhhh aaaaaaaaaaa

能给一具体的update吗?
update tb set INFO = @text
where 如何写
wuyq11 2010-08-23
  • 打赏
  • 举报
回复
update tb set b=a where 条件
caorenlong 2010-08-23
  • 打赏
  • 举报
回复
没看懂,DD_001_info, bis , DD_050_info ,都是列名吗?还是一行数据?
poloyzhang 2010-08-23
  • 打赏
  • 举报
回复
select 字段名 ..然后生成一张新表.


SELECT 字段名 INTO [myl].[dbo].[TaxRate] from ttest.dbo.TaxRate; --无须建立TaxRate表.创建表并复制了记录.

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧