Unleashing GenAI in Database Modernization: A Technical Exploration

In the ever-evolving landscape of technology, database modernization has emerged as a cornerstone for businesses seeking to maintain a competitive edge. The financial services and fintech sectors, along with healthcare and other data-intensive industries, find themselves at a crucial juncture. They are under relentless competitive pressure to innovate and improve their services. 

However, the weight of legacy systems becomes a formidable challenge, anchoring these industries to outdated processes that struggle to meet new demands. This is where the significance of database modernization is starkly evident — it is not merely an improvement; it’s a necessity for survival and growth.

Legacy systems, with their rigid structures and obsolete technologies, present a plethora of challenges. They are often incompatible with new software, lack the scalability to handle increased transaction volumes, and are vulnerable to security threats. Moreover, these outdated systems require specialized knowledge to maintain, making them a costly and inefficient aspect of modern IT infrastructure. 

Database modernization promises not only enhanced performance and security but also paves the way for implementing advanced analytics and achieving regulatory compliance, which is particularly crucial in sectors like healthcare where patient data privacy is paramount.


In the realm of IT modernization, especially regarding legacy systems, the introduction of advanced tools, including Generative AI (GenAI) “artificial pair-programing solutions” , marks a significant turning point. These sophisticated technologies are reshaping the developer’s workflow, yielding substantial improvements in productivity and accuracy.

As these tools  brings a layer of cognitive enhancement to the table. This is a game-changer for teams engaged in legacy modernization, as it enables them to restructure their old databases to be more in line with current market demands, ensuring agility and precision in their operations. With more pleasure and better developer experience.

For SQL-related tasks, which are critical in legacy systems, GenAI can be particularly impactful. They assist developers in reasoning and optimizing SQL queries to help with cleaning them up. Such tools can understand the context and semantics of SQL, combined with business and domain-knowledge acumen offering developers insights that are typically gained through years of experience.


The role of generative AI in database modernization cannot be overstated. Models such as ChatGPT-4 and Claude2 have demonstrated a remarkable ability to streamline the process of formulating and refining SQL queries. These AI models, trained on vast datasets, possess a nuanced understanding of SQL’s syntax, which, when coupled with the business acumen they have gleaned, can yield good results. 

They stand out in their capacity to manage complex, cumbersome SQL queries that would traditionally impose a significant cognitive load on human analysts.


Incorporating AI into database management systems unveils a few practical applications. 

For one, AI can translate complex SQL statements into natural language, greatly enhancing comprehension for those who may not be well-versed in SQL. This can be a boon for cross-functional teams that require a common understanding of database queries. Additionally, AI’s ability to simplify intricate queries is invaluable for maintaining clean and maintainable codebases.

Below there is example of ChatGPT capabilities to understand both technical and business realms based on some SQL Code I pasted from Northwind SQL queries.


The script is written for Microsoft SQL Server, performing database cleanup by dropping existing objects like procedures, views, and tables if they exist, then recreating some tables with indexes and constraints.


The domain is a sales and inventory management system, with business objects like employees, orders, products, customers, and suppliers suggesting a comprehensive enterprise resource planning (ERP) system or a customer relationship management (CRM) system.

The script lacks transactional control for the drop and create operations, making it risky for production environments.
* Wrapping the operations in a transaction could prevent partial updates.
* It should also include error handling to manage any issues that might arise during the execution.
* Including comments or documentation about the purpose of each operation and the impact on related data would improve maintainability

And then we can use Claude once more to give some brainstorming on which columns are missing. Quite naive but a great start for future brainstorming with the team.

Furthermore, you can leverage GenAI to generate diagrams from SQL queries using language like PlantUML.

Although Large Language Models are… well…. Language-oriented, using this trick can give you a visual representation of database structures.


Generative AI models don’t succumb to fatigue; they maintain consistent performance regardless of the complexity or volume of the queries they process. 

This is particularly beneficial when dealing with ‘dirty’ SQL queries that are in dire need of optimization. 

By employing these AI tools, businesses can ensure that their databases are not just operational but optimized for performance and manageability.

ChatGPT4 vs Claude2

When comparing ChatGPT-4 with Claude2, it’s important to consider their context window capabilities. ChatGPT-4, while generally providing higher quality SQL outputs, may be limited by a smaller context window compared to Claude2.

However, Claude2’s larger context window doesn’t necessarily translate to better performance in all scenarios. Practical experience suggests that ChatGPT-4’s precision in SQL query generation often surpasses that of Claude2.

For less performant models like ChatGPT3.5 use them only for very simple task. They are much much less performant and more confabulation prone.


Mastering the art of prompting is pivotal when interacting with AI models. Efficient prompting involves a strategic approach to communication, ensuring that the AI receives clear and explicit instructions. 

There are numerous resources and materials available that can aid individuals in honing their prompting skills. These resources often include best practices for query generation, such as being precise with entity names, stating conditions unambiguously, specifying desired output formats, and providing concrete examples to guide the AI’s responses.

Adhering to these practices ensures that the AI can generate accurate and relevant results, making it a more effective tool for database modernization. Effective prompting can transform the interaction with AI from a simple command-response dynamic into a nuanced and collaborative process that enhances productivity.

This is one slide from our presentation about prompting for developers

If I need to summarize good prompting in one slide here is my take:

Iterative Interaction: Instead of just asking and getting a single answer, treat talking with AI like a back-and-forth conversation. Keep the chat going until you get what you need.

Setting Clear Expectations: Tell the AI exactly what you want to achieve, the context around it, and the level of quality you’re aiming for. The more specific you are, the better the AI can perform. And always double-check the AI’s work – it’s not a tool for cutting corners.

Boosting Creativity: When you hit a mental block, use the AI to help you think differently. Ask it to simplify things, use fun metaphors, or point out what you might be missing, especially with security stuff. This can kick-start your brain into thinking about problems from new angles.


While generative AI has the potential to revolutionize database modernization, caution is imperative. These language models, despite their advanced capabilities, are not infallible. They can sometimes generate information that is inaccurate or not based on factual data, commonly referred to as ‘hallucinations’. It is, therefore, crucial to approach the integration of AI with a discerning mind, critically evaluating the outputs and corroborating them with verified data sources.

Moreover, the ethical considerations surrounding AI deployment, particularly in sensitive sectors such as healthcare and finance, cannot be ignored. Ensuring data privacy, maintaining transparency in AI decision-making, and adhering to regulatory requirements are all essential components of a responsible AI strategy.


The role of generative AI in database modernization is multifaceted and profound. By leveraging modern tools, optimizing SQL queries through generative AI, and applying AI in practical use cases, businesses can achieve a level of efficiency and effectiveness that was previously unattainable. As with any technological advancement, it is vital to employ these tools with a blend of enthusiasm and prudence. The future of database management is bright, and with the thoughtful application of AI, it can shine even brighter.

In this light, the role of GenAI in IT modernization is clear. It is not about replacing the developer but rather augmenting their capabilities, allowing them to focus on strategic tasks by offloading the repetitive and mundane. The result is a more efficient, error-resistant, and future-proof legacy modernization process.

Author: Cezary Dmowski, CTO, Co-Founder at ITSG Global

Let’s arrange a call and see how we can help you using the latest GenAI.

Join our newsletter

Subscribe to the newsletter to stay updated with the latest industry news
and our activities such as blogs and events!