Create database using script at the default path?

后端 未结 2 2022
日久生厌
日久生厌 2021-02-01 17:42

I\'ve generated a script of a database in SQL Server 2008. The generated script has the hardcoded path of where the database would be created. I don\'t want this path to be hard

相关标签:
2条回答
  • 2021-02-01 17:45

    Why don't use just:

    CREATE DATABASE [POS];
    

    This will create the database with all the default settings (including paths). You may alter any setting you like later on.

    0 讨论(0)
  • 2021-02-01 18:00

    Simply create the database and then adjust all the needed properties directly in files

    CREATE DATABASE [POS] 
    GO
    ALTER DATABASE POS MODIFY FILE 
    ( NAME = N'POS' , SIZE = 3048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
    GO
    ALTER DATABASE POS MODIFY FILE 
    ( NAME = N'POS_log' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
    GO
    
    0 讨论(0)
提交回复
热议问题