Filter out NULL values in Indexes
Received a great tip from my colleague on how to filter out NULL values in Indexes. How to use a WHERE-clause within an Index? Well take a look! CREATE NONCLUSTERED INDEX [IX_NC_ColumnName] ON...
View ArticleFunction: Calculate working days
I stumbled upon a very nice T-SQL function to calculate working days. I’ve created one before myself, but this one is very short and slick :) This example seems to be copied multiple times (here and...
View ArticleList columns and attributes for every table in a SQL Server database
A nice addition for your Cookbook (Code Snippets): Source sys.tables provides one row for each table in a database. This does include user tables and system tables that exist in each database. There is...
View ArticleStored Procedure: Automatically ‘Generate Scripts’ for local or linked server
Normally you would have done this manually: Time for a change! Schedule it in SQL Agent as a Stored Procedure and export it to a TXT-file. SP GenerateScripts on LocalServer On execution: To export it...
View ArticleSQL Server – Rare Event error
Today I received a SQL Sever error that was caused by a ‘rare event’. Simply adding just a single parameter to the same Stored Procedure triggered this event. By removing that single parameter, I...
View ArticleSelection of all parameter values – (All)
Another addition to your cookbook! A handy trick to simplify your report header information is by displaying ‘(All)’ instead of literary all parameter values. An example: By using this expression in...
View ArticleSQL Monitor on CodePlex (free standalone tool)
A few days ago someone posted a link to this very nice tool on LinkedIn: SQL Live Monitor @ CodePlex Description a .NET application that provides realtime performance data on the target SQL Server...
View ArticleSSIS: Text to ProperCase (derived column)
How to format text to ProperCasing? Found this SSIS Expression at SQLJunkieShare: (UPPER(SUBSTRING(TRIM(Name),1,1)) + TRIM(LOWER(SUBSTRING(TRIM(Name),2,FINDSTRING(TRIM(Name),” “,1) – 1 < 0 ?...
View ArticleSSIS – No status is available (NonColumnSpecificError)
In case your SSIS package fails to insert new records into a destination table and you receive an error message like: No status is available. [NonColumnSpecificError] In my case, the Error Description...
View ArticleFrom DATETIME(OFFSET) to VARCHAR(x), a world of differences :)
Always use the smallest data type, but in some cases this can really bite you. In my example, I’ve both DATETIME and DATETIMEOFFSET types in a single table. ‘Simply’ converting/casting both to strings...
View Article
More Pages to Explore .....