ChampakDas Posted October 23, 2012 Report Posted October 23, 2012 create temp table Declare @deleted (column) [quote name='ghazni' timestamp='1350959132' post='1302674268'] i did not get it mama what you said........ aina aa output anedi ekada petali..... [/quote] [quote name='ChampakDas' timestamp='1350951352' post='1302673408'] cool adhey mama reason...if there are no records in the source table all you get is 0 records affected. Ok now whats the best solution: keep track of the deleted records like this [color=#282828][color=#0000FF][font=arial, sans-serif][size=3]DELETE[/size][/font][font=helvetica, arial, sans-serif] [/font][/color][/color][color=#282828][font=helvetica, arial, sans-serif][size=1][font=arial, sans-serif][size=3]H [/size][/font][color=#0000FF][font=arial, sans-serif][size=3]FROM[/size][/font][/color][font=arial, sans-serif][size=3] LCMSDWData[/size][/font][color=#808080][font=arial, sans-serif][size=3].[/size][/font][/color][font=arial, sans-serif][size=3]DWDimHearing H[/size][/font][/size][/font][/color] [color=#282828][font=helvetica, arial, sans-serif][size=1][font=arial, sans-serif][size=3][size=6][b]OUTPUT DELETED.Somecolumn= identying column[/b][/size] -- deleted here will be the temp table...ela chesthey at this step we will delete the records from the table and also keep track of id's which we can use to delete in the subsequent tables...[/size][/font][/size][/font][/color] [/quote]
Chandrabhai5 Posted October 23, 2012 Report Posted October 23, 2012 Truncate all tables You will be promoted to manager
ghazni Posted October 23, 2012 Author Report Posted October 23, 2012 [quote name='ChampakDas' timestamp='1350959243' post='1302674288'] create temp table Declare @deleted (column) [/quote] nenu northwind lo try chestun mama syntax error vastundi...... amy be i will fix it tomorrow..... thanks anyway........ repu touchlo unta......
ghazni Posted October 23, 2012 Author Report Posted October 23, 2012 [quote name='Chandrabhai5' timestamp='1350959420' post='1302674309'] Truncate all tables You will be promoted to manager [/quote] already backup tisukoni dani mida work chestuna so truncate chesina em kadu.......
Bukka_Rowdy Posted October 23, 2012 Report Posted October 23, 2012 edi try chey baa ..oka temp table create chey first oka table create chey tableD with one coulm .. create tableD as (select colb from tableB where tableB.colb = tableA.colA and tableB.colb = tableC.colc) then delete for 1 st table delete from tableA where tableA.colA where exists (select colb from tableB where tableB.colb = tableA.colA and tableB.colb = tableC.colc) taruvata table b (ne secound table) delete chey delete from tableB where tableD.cold exists ( select tableD.cold from tableD where tableD.cold = tableB.colb)
Recommended Posts