Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Create Database


Create Database

Author
Message
kaspencer
kaspencer
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2384 Visits: 810
This question is very badly implemented. I knew it couldn't create a database on my system because it made too many assumptions:

1. Can I write to the root directory of my primary disc drive?
2. Do the absolute paths given for the file locations exist?

To the moderators of SQLServerCentral I repeat what I have said before: "Please ensure that questions posed can be answered based on knowledge of the question subject matter and that they are not affected unduly by local configurations.:

Kenneth Spencer

You never know: reading my book: "All about your computer" might just tell you something you never knew!
lulu.com/kaspencer
wnylibrarian
wnylibrarian
Mr or Mrs. 500
Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)Mr or Mrs. 500 (509 reputation)

Group: General Forum Members
Points: 509 Visits: 61
My MSSQL doesn't have permissions outside of "C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data". Therefore if you gave someone this script to run it could possibly fail on someone if they haven't modified permissions. So the answer is "YES," it will work to modify the extensions, but it is contingent upon other factors. This question is a little misleading for that reason.

***************
wnylibrarian
Buffalo, NY US
Don-909505
Don-909505
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 39
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\mssql\MYTEST.doc" failed with the operating system error 2(error not found).
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.


Me too.
pmcwhorter
pmcwhorter
Say Hey Kid
Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)Say Hey Kid (681 reputation)

Group: General Forum Members
Points: 681 Visits: 71
Simply given the infomation stated, answer is "no".

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.
dstemate
dstemate
Old Hand
Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)

Group: General Forum Members
Points: 333 Visits: 62
I would rephrase the question:
is it possible to create a DB with this code?

The way you put the the question is tricky!
Ernie Schlangen
Ernie Schlangen
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1776 Visits: 448
Ditto and...
Ditto to the edit, as well.
pkupsovsky
pkupsovsky
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 86
Running the risk of sounding like a smartar.. :-) Your example is as bad as the 'tested' code I get from my users. You know SQL server can create files but not directories. Nice point though regarding mdf, ldf, ndf

perhaps include:

exec xp_cmdshell 'MD c:\mssql'
go

cheers
Chad Crawford
 Chad Crawford
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2436 Visits: 18644
I agree that it is difficult to test when part of the question depends on the environment and configuration. I did think it was pretty easy to tell what the question was trying to point out though. I never thought of putting an .mp3 extension on my database - gave me quite a chuckle!
peter.marley
peter.marley
Valued Member
Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)Valued Member (68 reputation)

Group: General Forum Members
Points: 68 Visits: 29
Syntax incorrect on 2005
OzYbOi d(-_-)b
OzYbOi d(-_-)b
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1300 Visits: 778
DOH! w00t

A wee bit vague... I guess ultimately it caught me out since i made assumptions as to the permissions for SQL Server access to the stated directory...
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search