Muirik
Muirik

Reputation: 6289

Correct Syntax for MariaDB Update Statement

I am in the process of updating some old Access/SQL queries to run in a MariaDB environment. The following update statement is causing me problems. I've been working through it, but still haven't resolved it. I did try replacing Nz with COALESCE(). I also made note that StrComp is now STRCMP in MariaDB. It seems that STRCONV doesn't exist in MariaDB.

My question is: what does the following code do, and how can I reproduce this in a MariaDB-friendly way?

UPDATE ft.contacts
SET firstname = StrConv(firstname,3)
WHERE (((firstname)>"") 
AND ((StrComp(UCase(Nz(firstname)),Nz(firstname),0))=0)) 
OR (((firstname)>"") 
AND ((StrComp(LCase(Nz(firstname)),Nz(firstname),0))=0));

Upvotes: 1

Views: 165

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

for mimic the Capitalize function you could use

CONCAT(UCASE(LEFT(firstname, 1)), SUBSTRING(firstname, 2));

Upvotes: 1

Related Questions