Skip to content

Instantly share code, notes, and snippets.

@alexruzenhack
Last active November 27, 2018 14:34
Show Gist options
  • Save alexruzenhack/0d3bd7e72fae2f45c61c213593c68db3 to your computer and use it in GitHub Desktop.
Save alexruzenhack/0d3bd7e72fae2f45c61c213593c68db3 to your computer and use it in GitHub Desktop.
Query para criar uma função de extrair string do primeiro nome de string de nome completo no #mysql
CREATE DEFINER=`ruzenhack`@`%` FUNCTION `first_name`(name varchar(100)) RETURNS varchar(100) CHARSET utf8
BEGIN
declare firstName varchar(100);
SET firstName = ucase(substring_index(name, ' ', 1));
RETURN firstName;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment