Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Set default database and log locations in SQL Server Management Studio Express

Set default database and log locations in SQL Server Management Studio Express

Scheduled Pinned Locked Moved Database
databasesql-serverhelpsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kani98
    wrote on last edited by
    #1

    I have used the SQL Server Management Studio Express to set the default database and log file locations to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. I then use this string to try to create a database "If Not Exists(Select * From sys.databases Where Name ='DB001') CREATE DATABASE BD001 ON PRIMARY (NAME = DB001, FILENAME = 'DB001.mdf', SIZE = 2MB, MAXSIZE = 2GB, FILEGROWTH = 10%) LOG ON (NAME = DB001_Log, FILENAME = 'DB001.ldf', SIZE = 1MB, MAXSIZE = 5MB, FILEGROWTH = 10%)". However, I get the following exception: "CREATE DATABASE failed. Some file names listed could not be created. Check related errors." If I specify the entire path in the create string, then I can create the database without any problems. The problem I have is that when I deploy the application, I won't know the actual database path. I was under the impression that if I set the default database and log file locations using SQL Server Management Studio Express, then I don't need to specify the path in my create database string. Any help or explanation would be appreciated, thanks.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups