Monthly Archives: May 2014

Using RAISERROR in SQL Server 2008R2 and Earlier Versions

Over at the SQL Server Central forums, I just answered a question about the RAISERROR function in SQL Server 2008R2 and earlier versions. The original poster wanted to use RAISERROR in a CATCH block (after some logging, etc.) to return the original error to the calling application and halt further processing. Unfortunately, RAISERROR behaves much differently when used […]

Export XML from SQL Server Using bcp

*** Update – see the comments below for a solution to an issue with unexpected CR/LF characters in the XML file generated with this method. Thanks to reader Anthony for diagnosing the issue and providing the solution. *** A recent project at work included a requirement to generate a well-formed XML file from the output […]