Posts Tagged SQL

Ever needed to write a text file from within SQL Server?

Well, there are a three of ways of doing this:  Extended Stored Procedures, OLE Automation and SQLCLR. While it is out of the scope of this post, Extended Stored Procedures and OLE Automation are things that have been retained in the SQL Server product in order to maintain a measure of backwards compatibility.  Microsoft often […]

, , , ,

1 Comment

Concatenating Text using FOR XML

In my recent post about using CTE’s to concatenate text (see, I was very proud of myself and my genius. Then I read Majunath Bhat’s post “Grouping data from multiple rows into a single row” over on BeyondRelational (see With some small changes, I now see the beauty in using FOR XML PATH […]

, ,


Backing up all databases on SQL Server

I was reading a blog post by Paresh over on LinkedIn (see his post here) and his recommendation for automagically backing up all databases within a SQL Server instance.  It inspired me to share my backup stored procedure. What does mine do that Paresh (and many others) do not do?  Here’s what I generally do […]

, ,

Leave a comment

CTE to concatenate column values in multiple rows into a single string

UPDATE:  While using PIVOT and CTEs to concatenate strings is cool, I’ve found a better way using FOR XML… see ORIGINAL ARTICLE: Using SQL Server, one thing I’ve always done is used PIVOT to concatenate strings.  The one thing about that solution is you have to impose a maximum number of rows that will […]

, , , ,