HOST_ID and HOST_NAME Included in T-SQL for SQL Server is a functions that returns the workstation information that executes a SQL statement.  You can use this to record what workstation the transaction came from in your application or business intelligence processes. HOST_ID will return the Process ID from the client  machine that is running the … [Read more…]

SQL Saturday #408 Houston – June 13th 2015

Call for speakers is now open for SQL Saturday #408 in Houston, TX.  If you are interested in presenting please fill out the form – https://www.sqlsaturday.com/408/callforspeakers.aspx.  The call for speakers ends on 4/14/2015. For complete details on the event see – https://www.sqlsaturday.com/408/eventhome.aspx. SQLSaturday is a training event for SQL Server professionals and those wanting to … [Read more…]

Azure Data Factory

What is the Azure Data Factory? The Azure Data Factory is a managed service for data storage and processing.  It allows you to build cloud based solutions to move and store your data in a centralized managed environment.  Source data can be pulled from on premise or cloud environments consisting of structured, unstructured or semi-structured … [Read more…]


T-SQL EXCEPT and INTERSECT Both T-SQL EXCEPT and INTERSECT are set based operators that combine multiple query results back in the same result set.  EXCEPT returns the records from the query on the left that are not found in the right query.  INTERSECT returns the distinct rows that are in both the right and left queries. … [Read more…]

SSRS Farm to Scale-Out Performance

SSRS Farm Overview Building a SSRS farm will require Enterprise or Business Intelligence editions of SQL Server for versions 2012 and 2014.  SQL Server allows for the deployment of 2 or more servers running SQL Server Reporting Services to increase the performance of your reporting environment. SSRS stores its data in 2 databases (reportserver and … [Read more…]

T-SQL Random Numbers using RAND() for Test Data

T-SQL Random Numbers using RAND() SQL Server includes the T-SQL RAND() function to create a random value between 0 and 1 of float datatype.  To create a random number execute Select Rand(), in my example it returned .0131039082850364.  If I wanted to always return the same number I can include a seed value, such as … [Read more…]


T-SQL COALESCE SQL Server T-SQL coalesce simplifies the use of a case statement to find the first non-null value of your expression.  For example, I want to return the products in the AdventureWorks sample database and show the SellEndDate if it exists or the SellStartDate if the SellEndDate is null. Example Script: SELECT [ProductID] ,[Name] … [Read more…]


Row_Number SQL Server SQL Server includes several Ranking Functions that can be called in T-SQL.  One of these is the Row_Number() function.  You can use this function to return a sequential number in your result set that begins at 1. There are 2 arguments that can be passed into the function that determines how the … [Read more…]