Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Friday, January 29, 2021

Upgrading to MySQL 8: rank

 Rank is a reserved keyword in MySQL 8. Before upgrading, make sure it's not a table name, column, or alias used in a query.

Thursday, December 27, 2018

ColdFusion - using a colon in sql with queryexecute

queryexecute doesn't seem to allow escaping colons in sql.
Using MySQL regexp character classes will throw an error if entered in the sql directly.
A workaround is to add the regex expression as a queryparam.

The following will throw an error:
queryexecute("SELECT [column] REGEXP '[[:character-class:]]'...");

Here's the workaround:
queryexecute("SELECT [column] REGEXP :regex...",{regex:{value:"'[[:character-class:]]'"}});

Thursday, February 23, 2017

Converting from 1 column name to first / middle / last.

First name: SUBSTRING_INDEX(name,' ',1)
Last name: SUBSTRING_INDEX(name,' ',-1)
Middle Name: TRIM(REPLACE(REPLACE(name,SUBSTRING_INDEX(name,' ',1),''),SUBSTRING_INDEX(name,' ',-1),''))