Writing script to create an Archive Database for 2011

Con risposta Writing script to create an Archive Database for 2011

  • Friday, October 14, 2011 1:13 AM
     
     
    What would be the script for my data files and transaction log files to be placed in the Archive folder?  The Archive database name is HSC2011_ArchiveSS   The Archive folder is a sub folder of C:\MSSQL   The data file size is 10 MB and transaction log file size is 5 MB. 

All Replies

  • Monday, October 17, 2011 7:05 AM
     
     Answered Has Code

    Hi serverstudent1,

    Please see the following example:

    USE master;
    GO
    CREATE DATABASE C2011_ArchiveSS
    ON 
    ( NAME = C2011_ArchiveSS_dat,
        FILENAME = 'C:\MSSQL\Archive\C2011_ArchiveSS.mdf',
        SIZE = 10,
        MAXSIZE = 50,
        FILEGROWTH = 5 )
    LOG ON
    ( NAME = C2011_ArchiveSS_log,
        FILENAME = 'C:\MSSQL\Archive\C2011_ArchiveSS.ldf',
        SIZE = 5MB,
        MAXSIZE = 25MB,
        FILEGROWTH = 5MB ) ;
    GO
    
    

    Please also make sure the login have sufficient permissions to create a database.

    For more information, please see: CREATE DATABASE (Transact-SQL)


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Get or Request Code Sample from Microsoft
    If you have any feedback, please tell us.