Valinor
HOME   o    SERVICES    o    TOOLS    o    PROMOTIONS o    LEARNING o    ABOUT US

Overview of the products we offer and our vision

Monitor, diagnose and analyze SQL Server performance problems

Automate and optimize database defragmentation

View and manage SQL Server Jobs

Capture, audit and alert on SQL Server activity

Identify and mitigate SQL Server security risks

Accelerate, compress and encrypt database backups

SQL Server object and data comparison

Incredibly useful tools for SQL Server people

Script out your schema and objects easily!

SQL Scripter

Script out your schema and objects easily!

o Download o

General

SQLScripter is a Freeware command line utility that scripts SQL Server databases. The utility is designed to automate the process of schema generation.

SQLScripter was developed on SQL Server 2005 and therefore most of the tests were done on SQL Server 2005. I did however test SQLScripter on SQL Server 2000 to some extent.

In case you come across a need that SQLScripter does not cover in the current version please mail me your requirement to yaniv.etrogi@gmail.com with SQLScripter in the subject of the mail and I will try implementing it in an upcoming release.

Installation

Run SQLScripter.msi file to install the program at your preferred location.

The msi package contains the following files:

  • Microsoft.SqlServer.BatchParser.dll
  • Microsoft.SqlServer.ConnectionInfo.dll
  • Microsoft.SqlServer.RegSvrEnum.dll
  • Microsoft.SqlServer.Replication.dll
  • Microsoft.SqlServer.Rmo.dll
  • Microsoft.SqlServer.ServiceBrokerEnum.dll
  • Microsoft.SqlServer.Smo.dll
  • Microsoft.SqlServer.SmoEnum.dll
  • Microsoft.SqlServer.SqlEnum.dll
  • Microsoft.SqlServer.WmiEnum.dll
  • ICSharpCode.SharpZipLib.dll
  • SQLScripter.exe
  • SQLScripter.exe.config
  • ReadMe.htm
  • License Agreement .txt


Usage

Edit SQLScripter.exe.config file (see the bellow table for details).

Run SQLScripter.exe by any of the following methods:

  • Manually
  • SQL Server Agent job by selecting a Job Step of type "Operating system(CmdExec)"
  • Windows Task Scheduler
  • Call it from a batch file, a VBS file etc.


SQLScripter can be configured in various ways to run local or remote. i.e.: execute SQLScripter on Server1, script Server2 and place the output on Server3.

Comment

SQLScripter terminates with a return value of 0 on success and 1 on failure.

SQLScripter requires Microsoft .NET Framework version 2 installed on the machine where the executable resides.

SQLScripter does not script encrypted routines.

Support

When applying for support please send a description of the problem encountered to yaniv.etrogi@gmail.com with SQLScripter in the Subject of the mail and attach files SQLScripter.Log & SQLScripter.exe.config.

Key Value Description

Server

ServerName\Instance

ServerName

For a named instance

For a default instance

Database

Database

Database name of the database we are about to script

If "ALL" then we are about to script all user databases apart of Northwind, Pubs, AdventureWorks and AdventureWorksDW

ObjectsToScript

All

Scripts all objects for the defined database

U

Tables

V

Views

P

Stored Procedures

FN

UDFs

FK

Generates two files:

One file creates Foreign Key Constraints

One file drops all Foreign Key Constraints

TR

DML Trigger - Generates two files:

One file creates all Triggers

One file drops all Triggers

I

Generates three files:

One file creates all indexes

One file creates all indexes excluding PK

One file drops all indexes excluding PK

DDL

DDL Database Triggers

DDLSRV

DDL Server Triggers

SC

Schemas

RL

Database Roles

SRL

Server Roles

L

Logins

J

Generates two files:

One file containing all Jobs

One file containing all Jobs apart of Replication jobs and Maintenance Plan jobs

NFR

Generates nine files:

One file creates Foreign Key Constraints marked as NOT FOR REPLICATION

One file creates Foreign Key Constraints

One file drops all Foreign Keys

One file creates DML Triggers marked as NOT FOR REPLICATION

One file creates DML Triggers

One file drops all DML Triggers

One file creates Check Constraints marked as NOT FOR REPLICATION

One file creates Check Constraints

One file drops all Check Constraints

UG

Generates three files, this is the combination of J + L:
One file containing all Jobs
One file containing all Jobs apart of Replication jobs and Maintenance Plan jobs
Logins

OutputPath

The path where SQLScripter will create the folder and generate the script files. This can be a local path, a mapped drive, a network drive or a UNC path (Universal Naming Convention; \\computername\sharedfolder\resource).

If the OutputPath is not local a UNC path is the preferred option.

The account executing SQLScripter requires the appropriate permissions to connect and create folder and files at the OutputPath.

If OutputPath is not supplied or OutputPath is not a valid path then the current location is assumed (the location where SQLScripter.exe is executed from).

ZipDir

1

Zip the output folder

0

Do not Zip the output folder

ZipPW

If the ZipDir key is configured with a value of 1 then optionally you may protect the zip file with a password.

DeleteOutputPathAfterZip

1

If the ZipDir key is configured with a value of 1 then optionally you may delete the Output folder thus leaving just the zip file

0

Do not delete the Output folder thus leaving the zip file and the unzipped folder

AuthenticationMode

1

Windows Authentication

0

SQL Authentication (disregarded if Windows Authentication is selected)



Version history

1.0.00

First release

10/07/2007

1.0.01

Fixed minor issues of compatibility with objects not supported by SQL Server 2000

07/10/2007

1.0.02

Fixed minor issues of compatibility with objects not supported by SQL Server 2000

03/11/2007

1.0.03

Added connectivity using SQL Login

07/01/2008

1.0.04

Added the I (Indexes) switch

05/02/2008

1.0.05

Added the NFR switch

11/03/2008

1.0.06

Fixed a problem that the zip file was corrupted

17/11/2008

1.0.07

Fixed a problem that the zip file was corrupted
Added the passwords hashed to the Logins script (SQL 2005 only)
Add the possibility to supply a list of database names separated by a semi column in addition to a specific database name or the 'ALL' options available in previous versions
Add the UG switch
SQL Server 2008 compatible

19/02/2009


o Download o
-------
Copyright © 2006-2009 Valinor, LTD.
All rights reserved
build & design by Urielster