Posted on September 26, 2009, 8:33 pm, by Rhys, under
T-SQL.
So exactly what is a computed column? MSDN has this to say A computed column is computed from an expression that can use other columns in the same table. The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators. The expression cannot be a [...]
Posted on July 27, 2009, 3:00 pm, by Rhys, under
MySQL,
T-SQL.
Steve Novoselac posted a good article about using CROSS APPLY with TSQL. This is a really useful technique for transforming data into grouped lists. It made me think of a similar feature in MySQL, a function, called GROUP_CONCAT. Here’s a demonstration of CROSS APPLY with TSQL and GROUP_CONCAT in MySQL to achieve the same thing. [...]
Posted on June 12, 2009, 5:57 pm, by Rhys, under
T-SQL.
I do a fair bit of work with Linked Servers and cross-database queries and sometimes come across the following error when joining between databases with different collations; Msg 468, Level 16, State 9, Line 1 Cannot resolve the collation conflict between ‘Latin1_General_CI_AS’ and ‘SQL_Latin1_General_Pref_CP850_CI_AS’; in the equal to operation. To replicate this error run the [...]
Posted on June 8, 2009, 7:01 pm, by Rhys, under
MySQL,
T-SQL.
If you ever need to call a MySQL procedure from SQL Server it’s fairly simple thanks to ODBC and Linked Servers. This will allow you to reuse any logic already invested in MySQL Stored Procedures saving you from rewriting them. Here’s a simple example on how you can do it; Create the following procedure in [...]
Posted on April 7, 2009, 7:37 pm, by Rhys, under
T-SQL.
Not many people seem to be aware of the WITH TIES clause introduced in SQL Server 2005+. This simple feature is worth adding to your query armoury. In the words of BOL WITH TIES… “Specifies that additional rows be returned from the base result set with the same value in the ORDER BY columns appearing [...]
Posted on February 19, 2009, 4:03 pm, by Rhys, under
T-SQL.
One of the killer features of SQL Server is the ability to retrieve data from almost any source. Want to query MySQL, Access databases, text files, Active Directory, Exchange mailboxes or XML documents? All this is possible with SQL Server and is relatively simple to do so and all without resorting to SSIS. Getting data [...]