Creating an RSS feed from SQL Server content
In this recipe, we will create an RSS feed from SQL Server content.
Getting ready
For this task, we will use a trivial query to populate our RSS feed. We will just list our database list from sys.databases
, and use that as fictional content for our RSS file.
How to do it...
These are the steps to create an RSS feed using T-SQL and PowerShell.
Open the PowerShell console application by going to Start | Accessories | Windows PowerShell | Windows PowerShell ISE.
Import the SQLPS module as follows:
#import SQL Server module Import-Module SQLPS -DisableNameChecking
Add the following script and run:
#import SQL Server module Import-Module SQLPS -DisableNameChecking $instanceName = "KERRIGAN" $databaseName = "SampleDB" $timestamp = Get-Date -Format "yyyy-MMM-dd-hhmmtt" $rssFileName = "C:\XML Files\rss_$timestamp.xml" #values to be used for RSS $rssTitle = "QueryWorks Latest News" $rssLink = "http://www.queryworks.ca/rss.xml" $rssDescription = "What's new...