Solved

MySQL

Posted on 2011-02-28
8
382 Views
Last Modified: 2012-05-11
Is there a way to force the first letter of a field in a MySQL table to be upper case?

So when the INSERT (or UPDATE) is done, if the first letter is lower case, it makes it upper case?

Thanks
0
Comment
Question by:Richard Korts
  • 3
  • 2
  • 2
8 Comments
 
LVL 27

Accepted Solution

by:
yodercm earned 250 total points
ID: 35003302
.... SET Field = CONCAT(UCASE(SUBSTRING($input,1,1), SUBSTRING($input,2)))
0
 

Author Comment

by:Richard Korts
ID: 35013184
yodercm:

I am using php strings on a web server to update & insert data.

I'm not clear on where I put this.

In the table definition?

Thanks
0
 
LVL 40

Assisted Solution

by:Sharath
Sharath earned 250 total points
ID: 35013542
Create an AFTER INSERT trigger on your table. That will take care of updating the first letter of the field to upper case every time.
Replace the table and column names with your actual table and column names.
CREATE TRIGGER FirstLetter AFTER INSERT ON your_table
  FOR EACH ROW BEGIN
    UPDATE your_table SET Field = CONCAT(UCASE(SUBSTRING($input,1,1), SUBSTRING($input,2)))
  END;

Open in new window

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 27

Expert Comment

by:yodercm
ID: 35014162
Thanks a lot for the points (NOT) for giving you the MySQL structure you asked for.  I'm sure Sharath appreciates getting all the points for incorporating my answer.
0
 
LVL 40

Expert Comment

by:Sharath
ID: 35014743
I expect a split of points here as yodercm has provided you the actual logic and I just gave you a suggestion on how to implement that logic.
yodercm -  you can request moderator for split of points. I am happy for that.
0
 

Author Comment

by:Richard Korts
ID: 35062791
OK, I'm fine with that. How do I "request moderator for split of points"?
0
 

Author Comment

by:Richard Korts
ID: 35071985
To yodercm & Sharath_123:

I requested a moderator to split the points.

rkorts
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using in clause in query with many values 7 54
Mysql Left Join Case 10 70
Import MySQL data into MS Access using VB.Net interface 5 30
Where on a calculated field 1 22
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question