Table column Refactor

If you are here to find how to search and rename all tables and associated columns in SQL query, stored procedure and triggers. Then, here is the right place for you.

We provide tool that help you to search and rename specified tables and columns in thousands of SQL scripts precisely and quickly. Simple string or regex replacement doesn't work for this kind of task with complicated SQL query.


Take this SQL for example, If we need to change columm: AMAK_BASEPRICE.AMT to BOND_GOV:

SELECT SUM(C.AMT) AS AMT, FUND
 FROM (SELECT A.AMT AMT, A.AMAK_FUND AS FUND
       FROM AMAK_BASEPRICE A) C
GROUP BY C.FUND
ORDER BY AMT DESC

As you can see, AMT appears 5 times in above script. Only A.AMT inside subquery in from clause is the one need to be renamed, while other AMT should keep untouched.

So the result query should looks like this:

SELECT SUM(C.AMT) AS AMT, FUND
 FROM (SELECT A.BOND_GOV AMT, A.AMAK_FUND AS FUND
       FROM AMAK_BASEPRICE A) C
GROUP BY C.FUND
ORDER BY AMT DESC

Supported by the powerful parsing ability of General SQL Parser, this table and column search/rename tool had been successfully refactor more than one million SQL scripts in the past 5 years.



Live Demo

Try our live demo with your own SQL script to get desired result instantly.



Download this tool

Please download the latest version of General SQL Parser from download page.

For Java version, please check tableColumnRename.java under demos\gettablecolumns\ directory.

For .NET version, please check tableColumnRename.csproj under demoCollections\tableColumnRename\ directory.



Other useful tools

Supported Database

 

Google BigQuery

 

Couchbase database

 

IBM DB2 database

 

EMC Greenplum

 

SAP Hana

 

hadoop hive

 

Impala

 

IBM Informix database

 

MySQL database

 

Netezza database

 

Openedge database

 

Oracle database

 

PostgreSQL database

 

Amazon redshift

 

Snowflake SQL

 

Spark SQL

 

Microsoft SQL Server database

 

Sybase database

 

Teradata database

 

Vertica database

 

Microsfot Office Access database
Download General SQL Parser