fikir
Programmer
- Jun 25, 2007
- 86
I have two tables which are similar
declare @tbl table (id int primary key,
name varchar(100))
declare @tbl2 table (id int primary key,
name varchar(100),
flag varchar(10))
insert into @tbl select 1, 'abc'
union all select 2, 'bb'
insert into @tbl2 select 1, 'abc', 'no'
union all select 2, 'bb', 'no'
@tbl2 ia a copy of @tbl except @tbl2 has extra column 'flag'
my question is if any of data is changed in @tbl, I should get which column changed and update it to @tbl2,
both tables could have upto 72 columns,
what is the eaiest way to get the changed coulmn and update it to @tbl2
Thanks
declare @tbl table (id int primary key,
name varchar(100))
declare @tbl2 table (id int primary key,
name varchar(100),
flag varchar(10))
insert into @tbl select 1, 'abc'
union all select 2, 'bb'
insert into @tbl2 select 1, 'abc', 'no'
union all select 2, 'bb', 'no'
@tbl2 ia a copy of @tbl except @tbl2 has extra column 'flag'
my question is if any of data is changed in @tbl, I should get which column changed and update it to @tbl2,
both tables could have upto 72 columns,
what is the eaiest way to get the changed coulmn and update it to @tbl2
Thanks