Posted on June 12, 2010, 5:45 pm, by Rhys, under
MySQL,
T-SQL.
Not the sexiest blog title in the world but I thought I’d knock up a little post on the behaviour of MySQL and SQL Server with integer subtraction. How would you expect a database system to behave with positive and negative data types? Microsoft SQL Server doesn’t really have unsigned data types. All integer types [...]
Posted on February 17, 2010, 9:56 pm, by Rhys, under
MySQL,
T-SQL.
There’s few SQL techniques you seem to keep in the cupboard gathering dust. I don’t think I’ve ever needed to use RIGHT JOIN outside of the classroom. I can recall using FULL OUTER JOIN, just once, to show an employer how not-in-sync their "integrated system" was. Today I broke my professional Non-Equi JOIN cherry! I [...]
Posted on January 14, 2010, 9:18 pm, by Rhys, under
DBA,
T-SQL.
Today I received the following SQL Server error which I had never encountered before. Msg 4429, Level 16, State 1, Line 1 View or function ‘Table_1′ contains a self-reference. Views or functions cannot reference themselves directly or indirectly. Msg 4413, Level 16, State 1, Line 1 Could not use view or function ‘Test.Table_1′ because of [...]
Posted on October 31, 2009, 1:40 pm, by Rhys, under
DBA,
MySQL,
T-SQL.
I’ve recently been busy documentation various systems at work and came up with these queries to get a list of databases and their sizes for each SQL Server. These queries will show the server name, database names, and their sizes in KB, MB and GB. For SQL Server 2005 & 2008 ?View Code TSQL– SQL [...]
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 9, 2009, 4:10 pm, by Rhys, under
T-SQL.
Previously I wrote an article about fulltext searching with MySQL and thought I’d redo the same article but for SQL Server users. Depending of which side of the database wars you’re on SQL Server has either a more advanced or complicated way of doing things. Here’s a very brief introduction to the fulltext search features [...]
Posted on June 23, 2009, 7:05 pm, by Rhys, under
DBA,
MySQL,
T-SQL.
Asking for database documentation in many tech shops will result in blank stares. Other places do see the value of but it forever remains on the to-do list. There are a few commercial products available hoping to help with this; SchemaToDoc – http://www.schematodoc.com/ SqlSpec – http://www.elsasoft.org/ SQL Doc – http://www.red-gate.com/products/SQL_Doc/index.htm I’m not convinced of their [...]
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 June 5, 2009, 7:48 pm, by Rhys, under
MySQL,
T-SQL.
Several weeks ago I posted an article about Non-SELECT Joins in T-SQL and MySQL. The examples only covered INNER JOINS but sometimes we need to update, or delete, records in a table that do not have a corresponding record in another table. I’m going to illustrate the various methods for doing this in SQL Server [...]