Importing SQL Scripts in to the Database Project

One of the new things you will find in CTP5, is the Import Script Wizard. This wizard allows you to select a existing .SQL script file and import the DDL statement in to the database project as schema objects.

First you select an existing SQL script file. 

When you have selected an existing file, the Finish button enables and the wizard will take it from there. It will first parse the script file. As you can see in the Summary page below, when loading the good old INSTPUBS.SQL file from SQL Server 2000, it contains 81 batches and 355 statements, not all of these are DDL statement though. The we will check if a statement represents a DDL fragment, and if so we will turn it in to a schema object in the database project.

The Import Script functionality is basically doing the same as Import Schema, only instead of pulling schema from a database it gets extracted from a script file.

There are some minor differences. The main one being that the Import Schema option can only be executed once when there are no schema objects in the project; which is Import Schema is now part of the New Project Wizard. Import Script can be called many times, over and over again to add objects to the project. This means you can load the same file twice which will results in errors in the error list, indicating that you are trying to create duplicate entries.

Like Import Schema does not change the source database, Import Script does not change the input file; we simply shred the input stream and filter out the DDL statements.

This is the first incarnation of the Import Script Wizard, the next version will add a selection UI, which will show an overview of all the DDL objects detected in the script file; if the object does not exist in the project we will default to an Add operation (which you can change to Ignore if you do not want to add the object to the project). If the object does exist it defaults to Ignore the script unless you choose the Overwrite operation. This way you get more control,  prevent errors and cherry pick these objects you want to import in to the database project, but this will show up in CTP6.

That's it for now, back to getting CTP5 ready for release (next week),
"DataDude" Development Manager

Comments (9)
  1. We’re putting the final touches on our CTP5/Beta drop ( due out this Monday!!! ). The team has been absolutely…

  2. Rob Caron on which version of Team Foundation Server do I have?

    Joe Hummel on MSDNAA does provide…

  3. Rob Caron says:

    The blogging activity from the product team indicates that CTP 5 of Team Edition for Database Professionals…

  4. El Bruno says:

    Buenas, poniendome un poco al día me encuentro con las siguientes novedades para el no tan lejano CTP

  5. Kevin L says:

    There are a couple of cool things about creating projects/files.  First, the extensions are automatically added.  This creates great uniformity amongst projects.

    Second, creating objects by type or schema.  In large orgs which store multiple departments data in a single database this is a great feature.

    Found an issue with importing schemas from an existing database.  Not all objects are created in the corresponding folder.  For example, importing the AW database only put some triggers under the TableTriggers folder.  The same for xml indexes.  The remainder were placed at the project level.

    Once added, I had to manually move them through the file system to the correct folder, then do an Add Existing…to add them to the folder.  This then opened each file in the editor as it added it, then threw an error when it was done (null file name).

    However, this is a great product and I am very happy to finally have a good development tool for databases.


  6. El Bruno says:

    Buenas, poniendome un poco al día me encuentro con las siguientes novedades para el no tan lejano

Comments are closed.

Skip to main content