• John Sansom (5/13/2009)


    Hi,

    This of course does not work, unless the folder structures are in place on the system in question. Otherwise errors of the form below are returned.

    Msg 5133, Level 16, State 1, Line 1

    Directory lookup for the file "C:\mssql\MYTEST.doc" failed with the operating system error 2(The system cannot find the file specified.).

    Msg 1802, Level 16, State 1, Line 1

    CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

    Yep, as several others have already mentioned. If you take a few minutes to read CREATE DATABASE in BOL you'd see that it is required that the directory structure already be in place, therefore for this question it must be assumed that requirement was already met. Based on that, the statement works.