Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

delete rows with a condition from all tables

$
0
0

I am having 100 plus tables with millions of rows and having ID column and other columns too in 1 database on dev server ,

i will have to delete all rows from all tables except id 3000( which i will have to keep data in tables)

...

use xyz

delete from table1 where ID<>3000

i know i can use this for each table ,shrink the log files  and then delete another table and so on ...

i cannot use TRUNCATE as i am having a  where condition ...

can any one please suggest me a better way to do this ..delete all tables data where id<>3000 and should take of log files in parallell

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>