• Brian Ferguson (6/10/2009)


    Code as indicated does not work for me either.

    By adding a c:\mssql folder (did not have one on my system) AND changing the the data file folder to c:\mssql, it works.

    Create Database Mytestdb

    on

    (

    name ='Mytest_1',

    Filename= 'C:\mssql\MyTEST.mp3',

    size = 5000 KB

    )

    log on

    (

    name ='MyTest_2',

    Filename= 'C:\mssql\MYTEST.doc',

    size= 512 kb

    )

    But the code as written in the question will not work.

    If you read BOL, you will see that for CREATE DATABASE, the directory structure must already exist. Therefor, if you are going to run this code, you should have already ensured that the directory structure you are using in the CREATE DATABASE statement already exists. Based on that, the code works. Regardless if the code failed on your system when you attempted to run it.