Lest I forget… Wipe a database but retain schema


  1. EXEC sp_msforeachtable”ALTER TABLE ? NOCHECK CONSTRAINT all”
  2. EXEC sp_MSForEachTable”DELETE FROM ?”
  3. EXEC sp_msforeachtable”ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all”
  4. EXEC sp_MSforeachtable”DBCC CHECKIDENT ( ‘?’, RESEED, 0)”

The interesting things are:

  • There’s a clever ‘loop through all the tables’ stored proc
  • Line 1: You need to disable constraints (e.g. Foreign Keys etc) before you delete the data or they won’t let you delete stuff
  • Line 2: Then delete all the data from each table. You could probably use TRUNCATE which would be faster but wouldn’t give you the chance to not step 4 as it’ll reset the IDENTITYs automatically
  • Line 3: You need to turn the constraints back on again
  • Line 4: You can then reset all the IDENTITYs back to zero with the last statement

But worth also taking a look at the discussion on Stack Overflow about this approach and alternatives.

[I’m really just testing word publishing of posts - tbh, bit of a fail]

Just testing out cross posting from wordpress to blogs.msdn.com via Live Writer


Using http://clarius.codeplex.com/releases/view/6626 

Which then needs some text:

“The options deserve some more explanation besides being quite obvious:

  • Target blog: this is a dropdown that shows all the blog accounts you have currently registered in WLW. The “source” blog will always be the one you’re editing and publishing the current blog entry to.
  • Post summary: if checked, the cross-post will only contain the first 500 (200 is the default) characters of your current entry.
  • Preview post: this option (true by default) allows you to see in WLW the generated summary or full entry with back-link, and it will show up with the target blog selected in WLW, as well as a new Draft that you can save, publish, delete, etc. Once you get more confident with how the plugin works, you’ll typically want to unckeck this option, as it’s pretty annoying to end up with duplicate titles in your “Recently Posted” sidebar for every entry.

My plugin is leveraging all of WLW features for posting, so if you can post to a blog from WLW, you can cross-post to it with my plugin too. “

Hello! Welcome to ericnelson.wordpress.com, the new home of IUpdateable from Eric Nelson


You quite likely just arrived here because I today (August 26th 2011) updated my feedburner feed to point to this new blog. Apologies  for any “problems” this might have caused you in your favoured RSS reader. All should now settle down nicely.

But just in case … please make sure you are subscribing to http://feeds.feedburner.com/iupdateable OR (if you dislike feedburner) then direct to http://ericnelson.wordpress.com/feed/ 

As background:

I have moved here after a superb 30 months on http://geekswithblogs.net . GeeksWithBlogs is great but it doesn’t quite match what I am after in a blogging platform right now where as wordpress.com broadly does.

This will be my second change of platform in 7 years – it was back in July 2004 I created my first technology blog over on http://blogs.msdn.com/ericnel (which still acts as a mirror if you need to dig out any of my old posts). At the time I was an Application Architect inside Microsoft UK, I was very focused on early adoption work with SQL Server 2005 and I was looking for a broader way to help developers in the UK. A blog seemed to be a great way of doing this and I used it to share my learnings, thoughts, advice, best finds etc. throughout the beta of SQL Server 2005 and Visual Studio 2005. By 2009 I was following some great bloggers on http://geekswithblogs.net who spoke highly of it and I decided to request a blog on the site to tie up with a job change inside Microsoft UK. IUpdateable was born. 

Over the next few days I will bring across the best of my posts from the last year or so (Hence expect a lot of posts!) and then once that is done, I will mothball IUpdateable.

Thanks for reading.

Eric

One day on with wordpress.com


And … all looking well. Checked:
- Code snippets can be handled
- Slideshare can be handled
- Youtube can be handled
- Additional analytics can be handled (needed to switch from google to statcounter and getclicky as no javascript)
And even had a go at bulk importing some posts – very impressed with bulk recategorisation capabilities