I need a script that will take a 40GB 300+ table database and shrink it to the 1st 1000 rows in each table and delete security tables like tblchargecard. Want to get size to about 1gb to fit on a notebook for development. Any suggestions would be appreciated.declare a table variable with two columns, table_name and Table_rowcount.
From a join between sysindexes and sysobjetcs table, get the table names and their respective rowcounts into this table variable.
update the table_rowcount columns with table_rowcount-1000
write a script to automatically generate delete statements for each table, each delete statement being preceded by set rowcount table_rowcount and followed by set rowcount 0 statement.
run this generated script.|||Creative, but I think that will crash if you have relational integrity established, and especially if you are using cascading deletes.
If your database does have cascading deletes, (as it should) then just delete everything but, say, every 10th record, out of the highest level tables in the schema. (You can use something like WHERE Right(PrimaryKey, 1) <> 0 if you have numeric keys, for instance.) Do this in a copy of the database, of course!
As far as "delete security tables like tblchargecard", you'll have to specify those in your script.|||Thanks for the help from both of you. will give this a try.
Monday, March 19, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment