title: Windows Powershell: can I split a large SQL file into small files containing one db object
body: <p>We are using ERWin for data modeling and it generates a large SQL DDL files for all database objects, such as tables and views.  I am thinking to break this big file up into small ones, each containing one table, one view, for instance.  </p>
  
  <p>The goal is to reduce the manual work when deploying SQL DDLs with copy/paste each table into an execution windows because in development, usually only a few tables get changed.</p>
  
  <p>I see that each SQL ends with a semi-colon, ";" so I hope there is a way in PowerShell to find this delimiter and separate the large SQL file into many small ones.</p>
  
  <p>Greatly appreciate your help!</p>
  
  <p>Here is one sample SQL code with two tables.</p>
  
  <pre><code>CREATE SET  TABLE TABLE_1,
      NO BEFORE JOURNAL,
      NO AFTER JOURNAL,
      NO FALLBACK,
      CHECKSUM = DEFAULT
  (
  
      CAT_ID           INTEGER NOT NULL ,
      CAT_SECTION_ID   INTEGER NOT NULL ,
      CREATE_DTTM          TIMESTAMP(6) NOT NULL ,
      UPDATE_DTTM          TIMESTAMP(6) NULL 
  )
       UNIQUE PRIMARY INDEX UPI_CAT_SECTION
       (
              CAT_ID,
              CAT_SECTION_ID
       );
  
  CREATE SET  TABLE TABLE_2,
      NO BEFORE JOURNAL,
      NO AFTER JOURNAL,
      NO FALLBACK,
      CHECKSUM = DEFAULT
  (
  
      CH_NUM          VARCHAR(8) NOT NULL ,
      CH_YEAR   SMALLINT NOT NULL ,
      CREATE_DTTM          TIMESTAMP(6) NOT NULL ,
      LAST_UPDATE_DTTM     TIMESTAMP(6) NULL 
  )
       UNIQUE PRIMARY INDEX UPI_TABLE_2
       (
              CH_NUM,
              CH_YEAR,
                   );
  </code></pre>