July 10, 2018 at 1:28 pm
Hi,
In my table pp table is there.pp table having isactive field .
if i set isactive = 0 in pp table it will exports table records pp to pp_old table and after wards the pp table needs to Truncated
any scripts please above logic
July 10, 2018 at 2:00 pm
Diyas - Tuesday, July 10, 2018 1:28 PMHi,In my table pp table is there.pp table having isactive field .
if i set isactive = 0 in pp table it will exports table records pp to pp_old table and after wards the pp table needs to Truncated
any scripts please above logic
With > 4000 points, you should know better. Please post DDL, sample data and desired results
July 10, 2018 at 2:10 pm
pp source table -->select id,PPID,Name,Create_Date,Modified_Date, isactive from A.PP
pp_old destination table.--> select id,PPID,Name,Create_Date,Modified_Date, isactive from A.PP_old
July 10, 2018 at 2:27 pm
Diyas - Tuesday, July 10, 2018 2:10 PMpp source table -->select id,PPID,Name,Create_Date,Modified_Date, isactive from A.PP
pp_old destination table.--> select id,PPID,Name,Create_Date,Modified_Date, isactive from A.PP_old
With > 4000 points, you should know better. This does not qualify as DDL, sample data, or expected results. We don't have access to your database, so providing a query that can only be run against your database is pointless.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
July 10, 2018 at 2:48 pm
Okay, let us just throw out a wild a$$ guess:
declare @DeletedRec table (id int);
insert into A.PP_OLD
output inserted.id into @DeletedRec(id)
select * from A.PP where isactive = 0;
delete from A.PP [pp] where [pp].[id] in (select id from @DeletedRec);
-- or, you could just do this:
delete from A.PP where isactive = 0;
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy