Capitalize SQL Keywords using Notepad++


If you want to capitalize SQL Keywords like - Select, From, Where, Insert, Update, etc. in a SQL Query using Notepad++, then you can make use of the "Find and Replace" option with a regular expression.

  • Be on the File/Tab with the SQL Query.
  • Next, open "Find and Replace"
  • Make sure to set the search mode as "Regular expression"
  • Your "Find What" field will look something like the below.

    \b(SELECT|FROM|WHERE|AND|OR|NOT|INSERT|UPDATE|DELETE|CREATE|TABLE|INDEX|ALTER|DROP|JOIN|INNER|OUTER|LEFT|RIGHT|FULL|ON|GROUP|BY|HAVING|ORDER|ASCLet us take a look at how to Capitalize SQL Keywords using Notepad++UNION|ALL|DISTINCT|COUNT|SUM|AVG|MAX|MIN)\b

    And "Replace with" = \U$0

    Notepad++ Example Capitalize SQL Keywords
  • Click on "Replace All"

Caution: This does work, but it will also uppercase such keywords if they occur in your query data as well.


Do try out the SQL Formatting Plugin in Notepad++: https://code2care.org/howto/sql-formatting-plugin-in-notepad-plus-plus


This is not an AI-generated article but is demonstrated by a human on a Windows 11 PC running Notepad++ v8.5.6

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap