Previous Topic

Book Contents

Book Index

Next Topic

SQL Server - Alternative Methods

If the 'Create Archive Scripts' action cannot be used, the following alternative ways of archive creation exist for SQL Server:

Option 1 - Generate the DDL using SQL Server Management Studio

  1. In the 'Object Explorer' of SQL Server Management Studio, right-click the schema and call command 'Generate Scripts' from the 'Tasks' submenu.
  2. In the 'Set scripting options' dialog, click 'Advanced'. The 'Advanced Scripting Options' dialog opens.
  3. In the 'Advanced Scripting Options' dialog, make sure that:
    • Script Foreign Keys is set to 'False'
    • Script Indexes is set to 'False'
    • Script Triggers is set to 'False'
  4. Generate ("Publish") the script
  5. Open the generated DDL file in SQL Server Management Studio and

    Option A - to create the archive as a new database:

    A1. Replace the name of the database (in the whole script) with the same name but ending with _A (e.g. VM46B190_A)

    A2. Execute the script

    Option B - to create the archive as a new schema:

    B1. Create a new file group ARCHIVE and a new data file associated with this file group

    B2. Create a new schema (e.g. dbo_a)

    B3. In the generated file, replace schema [dbo] with [dbo_a] (also dbo. with dbo_a., which is often used in view definitions) and filegroup [PRIMARY] with [ARCHIVE]

    B4. execute the script

Option 2 - Generate the DDL using a Valuemation Console template

  1. Using the following Console template, generate the DDL needed to create the archive schema:

    -- $TABLESANDVIEWS$

    $TABLE.sql.archive$;

  2. Open SQL Server Management Studio
  3. Create a new empty database with the same name as the main database but ending with _A (e.g. VM46B190_A)
  4. Open an SQL worksheet and paste the content of the generated DDL into it
  5. Replace $QUALIFIER with the schema name (the same as for the normal database- e.g. dbo).
  6. Execute the script

    Important: remember to commit the changes after the script is executed (F11)!

See Also

Other Methods

Oracle - Alternative Methods

DB2