Creating a synonym for a MYSQL-linked server within SQL Server 2008 and above

In a current project it was a requirement to setup synonyms for tables that reside in a MySQL database. This MySQL database was added as “linked server” into SQL Server (via ODBC). If you do this for other SQL Server objects the syntax is like so CREATE SYNONYM app.EX_tbl_foobar FOR [LinkedServerName].[dbname].[schema].[tbl_foobar]; The problem was to […]

SQL Server FILESTREAM and master key

When dealing with RBS and SharePoint all guides provide the statement: USE [WSS_Content] IF NOT EXISTS (SELECT * FROM sys.symmetric_keys WHERE name = N’##MS_DatabaseMasterKey##’) CREATE master KEY encryption BY password = N’Admin Key Password !2#4′ If you ever asked yourself if its possible to leave that statement… The answer is no! Funny thing is that […]

Solving NULL values are recognized as text-values within dynamic queries in PostgresSQL

I’ve written a dynamic query which is finally executed via EXECUTE my_dynamic_query; The query contained a select list in which two columns should always be NULL. — … stuff before dynamic_select_cols := ‘,, null AS theAlias1, null AS theAlias2, tbl2.foo2’; — … stuff after combining the dynamic queries EXECUTE my_dynamic_query; In my case the […]


In der Praxis trifft man von Zeit zu Zeit auf aufgeblaehte SQL-Queries, die ausserordentlich kostenintensiven und langwierigen Ausfuehrungsplaenen folgen. Zeigt eine weitergehende Analyse, dass die komplexe Abfrage eine oder mehrere Subqueries enthaelt, die mehrfach ausgefuehrt werden, dann besteht eine sehr gute Chance durch Verwendung der sogenannten WITH-Klausel, die Performance der Abfrageausfuehrung erheblich zu steigern. Im […]