Free Career Guidance Expo Next Friday
SSWUG.ORG’s free virtual expo presents techniques for information technology (IT) professionals to enhance their professional life in 2012.
Through our in-depth sessions with some of the leading functional specialists in the IT field (Bill Pearson, TJay Belt, Chris Shaw and Tom Roush), you will see many examples and case studies on ways to improve communication between administrators and managers, develop a consulting business, learn from on-the-job mistakes and more.
By the end of our free event, you should have the tools and understanding needed to be a more productive and marketable IT professional ready for upward mobility.
Click here to sign up!
How to Copy a Database to Older Version of SQL Server
This is a great topic for our Accidental DBAs. Granted, it is SQL Server specific, but provides some ideas you could use on other engines as well.
I had a client contact me today because he couldn’t restore a backup of a database from his production server to a development server. The reason was that the production server had a newer version of SQL Server (2008 R2) than his development server (2008). In SQL Server, backups are not backwards compatible by default. You may want to check into the ability if you set the compatibility level to the earlier version, but I think I recall that also does not work.
So, what is a person to do in this situation? In SQL Server Management Studio you have two options easily available. First, you could script out the database. When you script an entire database there are options you can choose in the wizard to script schema, data, or both. If you choose data, it will script a complete list of insert statements. Be aware it may not script it in Referential Integrity order, and you have to massage the file to get things to work.
You also have the ability to do a database transfer by right clicking on a database in the server explorer, choose tasks, then choose import or export depending on the database instance you have chosen. This provides you with a wizard to configure the transfer much like the old Database Transfer Service from older versions of SQL Server (2000 and earlier).
Other engines have their techniques as well. Scripting out insert scripts one of the most flexible methods available for any engine…but results in large files.
Reader Comment: On Error Resume Next
Michael Writes:
One thing you also might point out is that On Error Resume Next makes it challenging to debug some complicated errors when trying to figure out an odd or intermittent error in WinDbg.
In WinDbg there is a way to have it automatically stop the thread when an error is raised. If On Error Resume Next is used then you get a bunch of false positive matches. You still have to do the little bit of work in WinDbg to find the existing stack trace and find which line of code you’re on.
So, if you have a bunch of these, it makes it hard to find what your true error is. I found that I had to rework code so that an Error is not fired so that I could eventually find the error that is actually an error and fix it.
Ever since I started using WinDbg I’ve tried to avoid errors at all cost versus in some cases take the easy way out and fire an error and handle it in the catch.
That’s it for this week. Please send me an email at btaylor@sswug.org with any feedback on previous discussions, or suggestions for topics you’d like to see.
Cheers,
Ben
$$SWYNK$$
Featured Article(s)
A Resurgence of Metadata Management
Are we poised for a resurgence of interest and attention being given to metadata and its management?
Featured White Paper(s)
All-At-Once Operations
Written by Itzik Ben-Gan with SolidQ
SQL supports a concept called all-at-onc… (read more)