How to Schedule a SQL Server Database Creation Script

  • Simon Shutter

    Newbie

    Points: 3

    Any idea why Enterprise Manager generates extra blank lines when generating scripts? After several cycles of scripting and rebuilding a db, there is a lot of white space in the script.

  • Charles Kincaid

    SSChampion

    Points: 13593

    You said "although it appears to be missing in SQL Server 2005 beta."  While that might be true it seems to be missing from the release version as well.  Could this be because it is not compatible with some of the new objects?

    ATBCharles Kincaid

  • Rod Weir

    Old Hand

    Points: 323

    ApexSQL Script is the best for doing this type of this. Correct dependency order, scripting, custom tags + much more. Great product. Great support.

    http://www.apexsql.com/sql_tools_script.asp

    Rod

  • mark blakey-271739

    Newbie

    Points: 7

    I'm trying to use the sql 2000 version of scptxfr on sql 2005 however the script seems to keep running for days in databases where there are a lot of dependencies. Has anyone else experienced this or knows of a workaround?

  • ourdai

    SSC Enthusiast

    Points: 109

    Is it me ?

    I get all sorts of spurious errors if the command string is not all on one line.

  • nirazeminem-763096

    SSC Rookie

    Points: 27

    Hi guys,

    i need to create a database..

    i don't how to script it create the database dynamically..

    if anyone could help it will be greatly appreciated..

    by the way i am using sql server 2005...

    i have already tried the following script..

    it doesn't work though....

    USE master

    GO

    CREATE DATABASE Student

    ON

    ( NAME = Student_dat,

    FILENAME = 'c:\program files\microsoft sql server\mssql\data\Studentdat.mdf',

    SIZE = 20MB,

    MAXSIZE = 70MB,

    FILEGROWTH = 5MB )

    LOG ON

    ( NAME = 'Student_log',

    FILENAME = 'c:\program files\microsoft sql server\mssql\data\Student.ldf',

    SIZE = 10MB,

    MAXSIZE = 40MB,

    FILEGROWTH = 5MB )

    GO

    cheers.....

  • BobMcC

    SSCrazy

    Points: 2226

    I'm sorry to resurrect this guy from the dead, but I'm curious as to what the conventional wisdom is for the SCPTXFR tool for sql 2008?

    I know I can right click in SSMS and generate scripts for the entire database. What if I want to regularly create and back up those scripts?

  • bijayanix24

    SSC-Addicted

    Points: 417

    SQL Server Management Objects (SMO) are objects designed for programmatic management of Microsoft SQL Server.

    We can integrate SMO into any .NET based applications.

    SMO is also compatible with SQL Server version 7.0, SQL Server 2000, and SQL Server 2005, which makes it easy to manage a multi-version environment.

    Following code is used to run the Microsoft SQL Server Query files(script files) kept in

    applications bin\Debug folder, with SMO.

    Cheers,
    Bijayani
    Proud to be a part of Team Mindfire.

    Mindfire[/url]: India's Only Company to be both Apple Premier & Microsoft Gold certified.

  • lewcrippen12

    SSC Rookie

    Points: 32

    Hello,

    Hey....It's really interesting article & I found something new procedure for working.

    Thanks

    Regards

    Lew

    Database Creations

  • lewcrippen12

    SSC Rookie

    Points: 32

    Hello,

    Hey....It's really interesting article & I found something new procedure for working.

    Thanks

    Regards

    Lew

    Database Creations

  • jsheck59

    Grasshopper

    Points: 21

    Great article. Does this same option exist in SQL 2008 R2? It is not located in the same area as mentioned in the article and I would like to do something like this in SQL 2008? Or is there a better way in 2008 for automatically generating database creation scripts rather than EM?

    Thanks,

    John

Viewing 11 posts - 16 through 26 (of 26 total)

You must be logged in to reply to this topic. Login to reply