Tag Archives: T-SQL

Joys With Datetimes

Sometimes we need to generate current timestamp in a special format (e.g. suffixes for backup files). If we are unlucky that requested format is not supported by CONVERT function and SQL Server version is 2008 R2 and older this might … Continue reading

Posted in Microsoft SQL Server | Tagged , , , , | Leave a comment

T-SQL vs. MDX

Although MDX has some similarities with T-SQL these languages are in many ways different. MDX is an acronym for MultiDimensional expression. Nowadays MDX is implemented in many non-Microsoft analytical platforms. Like T-SQL MDX in SQL Server has two usages: Expression … Continue reading

Posted in Microsoft SQL Server | Tagged , , | Leave a comment

When stored procedure slows down

This post will be about stored procedure that began to slooooow down. Background info I came across a datamart with ETL loading processes last year. Both of those were very poorly written (Currently after my changes it is a little … Continue reading

Posted in Microsoft SQL Server | Tagged , , , | 2 Comments

Get first and last day of month in SQL 2012 and SQL 2008 and earlier

This article has been reviewed, improved and moved to my new blog http://blog.hubacek.uk/get-first-and-last-day-of-month-in-sql-2012-and-sql-2008-and-earlier/ Today I had to create an ETL for batch loading of records into data warehouse for the current month. For this I had to get first and last day … Continue reading

Posted in Microsoft SQL Server | Tagged , , , , , , , , , , | 4 Comments

Use your text / CSV files in your queries via OPENROWSET

This article has been reviewed, improved and moved to my new blog http://blog.hubacek.uk/use-your-text-csv-files-in-your-queries-via-openrowset/ On Friday I was asked by my friend whether I could help him with text file access via OPENROWSET with Ad Hoc Distributed Queries. So I stopped by to … Continue reading

Posted in Microsoft SQL Server | Tagged , , , , | 3 Comments

Iterate through all databases / tables. Is sp_MSforeachdb good idea?

Ever heard of sp_MSforeachdb or sp_MSforeachtable procedures which iterates through all databases or tables? Well you might not because they are undocumented procedures about which Microsoft says are for internal use only and might not work for all scenarios. Also … Continue reading

Posted in Microsoft SQL Server | Tagged , , , , , | Leave a comment