Last post Sep 11, 2017 02:18 PM by limno
Sep 07, 2017 11:37 AM|asp.ambur|LINK
In my database I have 50 Table
For example In 20 Table I have RefNo I want to delete record of some RefNo as of now...
Later after few days I want to store them back..
How To Do So..?
Sep 07, 2017 12:16 PM|asyed4u|LINK
one of soultion as below [Logical Delete]
1. add new column 'IsDeleted' ( example : if char datatype ; by default value 'N' )
2. if delete required, just change the value 'Y')
3. so, select * from somtable where IsDeleted='N' ) for active records
4. select * from sometalbe where IsDeleted='Y' ) for deleted records ,,,,,,,,,,
5. later we can restore by change the value 'N' (based on any special condition)
Sep 07, 2017 12:50 PM|asp.ambur|LINK
Thanks For Your Reply
As i cant able to set IsDeleted Coz I have lot of Tables in Data... And This Data shows many Reports..
So in report lot of store procedure are there so any other method..
Sep 07, 2017 01:30 PM|asyed4u|LINK
refer : http://www.sqlservercentral.com/articles/T-SQL/148014/
1) current table "customer"
2) we need to create new table like "customer_deleted"
3) by using Trigger concept , we can move the deleted records to "customer_deleted" table
Sep 08, 2017 10:08 AM|asp.ambur|LINK
Example: Take ReferenceNo field : R2 this field will have more then
one table each table have no of fields will be different.
also each table will hold R2 datamore then one row or one row.
How to do this type of scenrio
Sep 11, 2017 05:27 AM|Deepak Panchal|LINK
you had mentioned that,"Take ReferenceNo field : R2 this field will have more then
one table each table have no of fields will be different. also each table will hold
R2 datamore then one row or one row."
for that first we need to see the database design and understand it.
we need to check that it is properly designed and same data not get stored multiple times and duplicates in multiple tables.
in that situation , first need to correct the database design and then try to think how to delete the data temporary and restore it when it needs.
at that situation also you can try to refer the suggestion given by the other community member to create tables where you can store the data when you can delete it from main table.
Sep 11, 2017 02:18 PM|limno|LINK
You don't delete data from your table if you still need them. Design your table to store data and retrieve them with filter. You table should contain timestamp type columns and you can choose the range of datetime when you need them.