Often I'm asked by collaborating agencies and organizations for a copy of our databases. True, I could do an export and give them just the tables, but I'm just making work for them. The easiest solution would be to export the SQL Server database with all the data types, rules, triggers, views and stored procedures. What's the problem? Log files on my databases are at least several hundred megabytes if not gigabytes. One option is it simply send them the mdf and ask them to attach the mdf and in SQL Server 2008 if you delete the ldf reference in the attach dialog it will auto-create one. If you want to include the ldf to avoid the conversation or have other reasons to reduce the log file it gets a little more complicated because if transaction logging is enabled the simple dropdowns won't do squat. Compacting a log file for database YOURDB: Start a new query Enter the following: -- Set the database to manipulate Use YOURDB; go -- Truncate the log by ...
One Idea A Day, What I Learned Today