CREATE DATABASE using file in default path

前端 未结 6 1513
借酒劲吻你
借酒劲吻你 2021-02-05 03:28

I want to create an SQL script that creates a database. Right now, I have this:

CREATE DATABASE [Documents] ON  PRIMARY 
( NAME = N\'Documents\', FILENAME = N\'         


        
6条回答
  •  孤城傲影
    2021-02-05 04:07

    Create the database 'Documents' and give file properties through an alter.

    USE [master]
    GO
    
    CREATE DATABASE [Documents]
    GO
    
    ALTER DATABASE [Documents] MODIFY FILE
    ( NAME = N'Documents', SIZE = 512MB, MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
    GO
    
    ALTER DATABASE [Documents] MODIFY FILE
    ( NAME = N'Documents_log', SIZE = 256MB, MAXSIZE = UNLIMITED, FILEGROWTH = 10% )
    GO
    

    This script is more portable and can be deployed in multiple servers without any modifications.

提交回复
热议问题