Please help..
I am writing a update query which has to update the @prod2 table column prod1 with the values of @Upprod table column prod2.
Please correct the query if anything needs to be corrected in the below query.
there are nearly 1500 records to be updated below is sample data..
declare @Prod2 table
(
Csid bigint,
Prod1 numeric(5)
)
insert into @Prod2
select 4103, 1946 union all
select 4101, 1956 union all
select 4102, 1904
select * from @prod2 order by csid
declare @Upprod table
(
Csid int,
Prod2 numeric(5)
)
insert into @Upprod
select 4102, 1956 union all
select 4103, 1936 union all
select 4101, 1964
select * from @Upprod order by csid
update @prod2 set prod1=Prod2 from @prod2 A,@Upprod B
Where A.csid=B.csid
select * from @prod2 order by csid
I am writing a update query which has to update the @prod2 table column prod1 with the values of @Upprod table column prod2.
Please correct the query if anything needs to be corrected in the below query.
there are nearly 1500 records to be updated below is sample data..
declare @Prod2 table
(
Csid bigint,
Prod1 numeric(5)
)
insert into @Prod2
select 4103, 1946 union all
select 4101, 1956 union all
select 4102, 1904
select * from @prod2 order by csid
declare @Upprod table
(
Csid int,
Prod2 numeric(5)
)
insert into @Upprod
select 4102, 1956 union all
select 4103, 1936 union all
select 4101, 1964
select * from @Upprod order by csid
update @prod2 set prod1=Prod2 from @prod2 A,@Upprod B
Where A.csid=B.csid
select * from @prod2 order by csid