Create Database

  • Steve Jones - Editor (5/13/2009)


    We don't allow post deletions. We do allow editing.

    duly noted, thanks.

  • I'm surprised that this is treated as a T-SQL issue rather than Administration, as I regard database space creation as Admin.

    To me, T-SQL stands for 'Transaction(al) SQL', and I don't see much in the way of transactions for space creation. Or is this something that people do in transactions & then roll back?

  • Yep I said No, but if you think little bit more about creating DB details, you will said yes...the default for data file was mdf, ndf and for log files was ldf...but you can put any format doc, pdf, mp3 sure that it is not preferable couz you can confuse yourself with the files. On the other hand it is very tricky - security thing!

    :hehe::hehe:

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • 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.

  • 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.

  • ????

    ??????????

    create database test

    --????

    on primary

    (

    --??????

    name='test _lj',

    --?????

    filename='D:\Develop_Files\Database\ test.mp3',

    --???????

    size=3MB,

    --???????

    Maxsize=10MB,

    --????

    filegrowth=1MB

    )

    --??????

    log on

    (

    --??????

    name=' test _log',

    --???????

    filename='D:\Develop_Files\Database\ test.doc',

    --????????

    size=3MB,

    --????????

    Maxsize=10MB,

    --????

    filegrowth=1MB

    )

  • wow what a chines DB creation ...and the problem is !? :w00t::hehe::w00t:

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • ???,???????????????,??????,???

    Thanks,man. It seems that you r a senior in the forum. if I have any qus. in the future, ask you OK?

  • Please post questions in the appropriate forum. This forum is for author comments. Moving to 2005-admin.

    If you have questions, just post in a forum, someone will see it and try to answer.

  • I have a question... I've changed the script to use C:\ for both files as follows:

    Create Database Mytestdb

    on

    ( name ='Mytest_1', Filename= 'C:\MyTEST.mp3', size = 2000 KB

    )log on(

    name ='MyTest_2', Filename= 'C:\MYTEST.doc', size= 512 kb)

    and get the following error:

    Msg 5123, Level 16, State 1, Line 1

    CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\MyTEST.mp3'.

    Msg 1802, Level 16, State 4, Line 1

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

    I am administrator of my machine and the DB is installed locally and I'm sysadmin....

    When I change the files to C:\temp\filenames... (with temp folder being existant)... it works!!! :ermm:

    Can someone explain if this behavior is normal?? I'm suspecting that it's some type of setting on my account... :doze:

  • jghali (6/4/2010)


    ...

    Create Database Mytestdb

    on

    ( name ='Mytest_1', Filename= 'C:\MyTEST.mp3', size = 2000 KB

    )log on(

    name ='MyTest_2', Filename= 'C:\MYTEST.doc', size= 512 kb)

    ...

    CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\MyTEST.mp3'.

    ...

    Can someone explain if this behavior is normal?? I'm suspecting that it's some type of setting on my account... :doze:

    The permissions required are for the account that SQL Server is running under, not your account.

    To see what account that is, open the services panel (services.msc) for example, and find the MSSQL Service.

    http://poorsql.com for T-SQL formatting: free as in speech, free as in beer, free to run in SSMS or on your version control server - free however you want it.

Viewing 11 posts - 46 through 55 (of 55 total)

You must be logged in to reply to this topic. Login to reply