表1:
t_news_sort
字段:
id
ParentId
SortName表2:
StaticContent
字段:
sortid
content请问怎么做才能让表2中的sortid字段和表1中的id字段同步呀,也就是说,表1每新建一个字段,表2也自动新建一个字段呀?最好也包括表1中的现有字段。
t_news_sort
字段:
id
ParentId
SortName表2:
StaticContent
字段:
sortid
content请问怎么做才能让表2中的sortid字段和表1中的id字段同步呀,也就是说,表1每新建一个字段,表2也自动新建一个字段呀?最好也包括表1中的现有字段。
for insert
as
insert 表2 (sortid)
select id from inserted
go
insert into insert 表2 (sortid)
select id from 表1 where not exists(select 1 from 表2 where sortid=表1.id)