Sql Script to generate a Database script


How to generate database script using Sql Server Script.

The following ode will generate the Sql Script for a given Database;

In the below code i'm using [MySampDataBase]

The following code will generate the full script for the Database

[MySampDataBase].


USE [Master]

/******
Object: Database [MySampDataBase]
Script Date: 03/22/2010 10:43 PM
******/

CREATE DATABASE [MySampDataBase] ON PRIMARY
(
NAME = MySampDataBase_Data'
, FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MySampDataBase_Data.mdf'
,SIZE = 174080KB
,MAXSIZE = UNLIMITED
,FILEGROWTH = 16384KB
)
LOG ON
(
NAME = MySampDataBase_Log'
,FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MySampDataBase_Log.ldf'
,SIZE = 2048KB
,MAXSIZE = 2048GB
,FILEGROWTH = 16384KB
)
GO
ALTER DATABASE [MySampDataBase]
SET COMPATIBILITY_LEVEL = 100
IF (FULLTEXTSERVICEPROPERTY('IsFullTextInstalled') = 1)
BEGIN
EXEC [MySampDataBase].[dbo].[SP_FULLTEXT_DATABASE] @ACTION = 'enable'
END
GO


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: