Separate the SQL Commands in a SQL script

Sometimes you just want to get separate SQL statement from a big SQL script, this is not that easy in a SQL Server script, because there is no delimiter operator such as ; required to separate SQL statements in SQL Server script like Oracle or other databases do.

General SQL Parser can help you to achieve this quickly.

Code in Java:

    TGSqlParser sqlparser = new TGSqlParser(EDbVendor.dbvmssql);
    sqlparser.sqlfilename  = args[0];

    int ret = sqlparser.getrawsqlstatements();
    if (ret == 0){
        for(int i=0;i<sqlparser.sqlstatements.size();i++){

Download this dem: Java version

Leave a Reply

Your email address will not be published. Required fields are marked *