Hit me baby one more time (MySQL Style)

So yesterday I blogged on how to create a T-SQL custom scalar function in SQL Server to clean up a DATETIME and output it like this... 05/11/2010 11:37 AM. So for anyone who is primarily using MySQL (most of our clients use SQL Server but we also take care of some MySQL driven CF apps too) here is the same code for creating and calling your very own inline function on the MySQL platform.

[More]

A quick SQL Server tip

Have you ever wanted to quickly migrate selected table data back and fourth from your dev database to your live database? If the answer is yes then this one's for you.

[More]

Looking for a MySQL equivalent for SQL Server's ISNULL function?

SQL Server has a well known and widely used ISNULL function that actually replaces a null column value or null subquery value with whatever you specify. For example, if you were to write

view plain print about
1SELECT ISNULL(UnitPrice,0)
2FROM InventoryItem

then you would have zeros returned in your result set for all InventoryItem table records that had a NULL value for the UnitPrice field. Ever tried to do that in MySQL? It doesn't work because MySQL's ISNULL function simply returns a value telling you whether or not the argument to the ISNULL function was NULL or not. Not as cool when compared to SQL Server's nifty replace type of functionality now is it? But wait, no need to talk smack about MySQL - for there is another great and easy to use command in MySQL that will give us the same result!

[More]

Date and Time formatting in MySQL

Most developers familiar with SQL Server have employed the easy to use CAST or CONVERT commands in order to properly format a date. Here's a simple example of CONVERT helping us get a value in the format of MM/DD/YYYY.

view plain print about
1SELECT CONVERT(VARCHAR(10), MyDateField, 101) AS MyDateFieldDisplay
2FROM TableName
This is a great command and it's very easy to use - but do you know how to format date and time values in a similar fashion when coding against a MySQL database? You can use the DATE_FORMAT command and here's how...

[More]

BlogCFC was created by Raymond Camden. This blog is running version 5.9.5.007. Contact Blog Owner