表A
id item
a1 b1
a2 b2
a3 b3表B
id item name
1 b1 xxx
1 b1 yyy
2 b2 xxx
3 b3 xxx我想要表B里的item跟随表A的item变化,有没有什么办法?页面用asp的,数据库为access,最好给我段代码,谢谢!
id item
a1 b1
a2 b2
a3 b3表B
id item name
1 b1 xxx
1 b1 yyy
2 b2 xxx
3 b3 xxx我想要表B里的item跟随表A的item变化,有没有什么办法?页面用asp的,数据库为access,最好给我段代码,谢谢!
解决方案 »
- 求个更新语句啊
- 当内容是date时,日期范围可 between '1980/1/1' and '2050/1/1',就基本囊括所有日期;但是nvarchar时,如何能囊括所有内容?即between an
- 大家帮个忙,分布式的问题
- SQL的bigint类型,长度为8,最多支持多少条记录,有人说只支持6万多条,对不对?怎么计算?
- ~~~~~这个SQL如何写?~~~~~~
- 转换格式的sql
- 2005
- 一个简单的客户端访问服务器端的问题
- 请教:谁用EWWin导过表结构到acess中?
- 一个管理系统,要求数据导入导出,可以生成上报盘,读取盘中数据可以重新恢复进数据库。开发语言为Delphi,如何实现?
- 请教一个简单的查询问题
- 求救一个关于数据库的设计问题...
id item
a1 b1
a2 b2
a3 b3表B
id item name
a1 b1 xxx
a1 b1 yyy
a2 b2 xxx
a3 b3 xxx
是这样的,就是表A和表B,表A是参照..
如我调出表A的内容,id item
a1 b1
办里是输入框:
id item name
a1 b1 xxx希望调同的表A的值能和表B的值对应...如果表A中的序列有变化,依然能对应...
你是指,表A的ID发生了变化?
if object_id('ta') is not null drop table ta
set nocount on
go
create table ta (id int identity(1,1),item varchar(10) primary key )
insert into ta select 'b1' union all select 'b2' union all select 'b3'
go
create table tb (id int , item varchar(10),constraint FK_tb foreign key (item) references ta(item) on update cascade)
insert into tb select 1,'b1' union all select 1,'b1' union all select 2, 'b2' union all select 3,'b3'
go
select * from ta
select * from tb
/*id item
1 b1
2 b2
3 b3id item
1 b1
1 b1
2 b2
3 b3
*/
go
update ta set item='b8' where item='b2'
go
select * from ta
select * from tb
/*
id item
1 b1
3 b3
2 b8id item
1 b1
1 b1
2 b8
3 b3
*/
set nocount off
设计表时,上面工具栏有一个关联的
点进去
设置下表A与表B的ITEM字段间的更新关联就可以了
但是我B表中会存在多个相同的item哟,会不会出现问题?