Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»

Create Database Expand / Collapse
Author
Message
Posted Wednesday, May 13, 2009 8:52 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 2:33 AM
Points: 1,713, Visits: 6,245
Lynn Pettis (5/13/2009)
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.



Wouldn't an equally valid assumption be that the requirement was not already met (as the path does not exist in a standard installation), and hence that the statement does not work?

Anyway, I'll quit whining as I'm too ignorant to think up any questions of my own
Post #716076
Posted Wednesday, May 13, 2009 8:53 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, June 30, 2014 2:30 AM
Points: 1,614, Visits: 890
I don't dare submit a question - I'd hate to be on the receiving end of all these complaints!

And besides, the only questions I can think of are ones to which I don't yet know the answer...

I repeat from a post on a previous thread though - I love SSC.
Post #716077
Posted Wednesday, May 13, 2009 8:59 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:53 PM
Points: 33,063, Visits: 15,179
The requirement for the path to exist could be a question. That's certainly valid, but this question asked "will this work" (originally) and then "can this work" (edited). In either case, given the right situation, it will (and can).

It's a simple yes/no, so you would lean yes. If it can never work, as in

CREATE DATABASE MyDB on SAN="\\mysan\mymount"

Then you would lean no.

Feel free to try a question. they don't automatically go out. I look over them and will send them back if they're too vague. So definitely I make mistakes on some of these as well.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #716083
Posted Wednesday, May 13, 2009 9:27 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 10:33 AM
Points: 344, Visits: 1,543
Lynn Pettis (5/13/2009)
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.



I did actually attempt to remove the post almost immediately after posting it, having only subsequently then noticed the prior pages comments, so yes my mistake.

For some reason though, I am unable to remove the post.



John Sansom (@sqlBrit) | www.johnsansom.com
Post #716123
Posted Wednesday, May 13, 2009 10:25 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:53 PM
Points: 33,063, Visits: 15,179
We don't allow post deletions. We do allow editing.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #716174
Posted Wednesday, May 13, 2009 10:29 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 10:33 AM
Points: 344, Visits: 1,543
Steve Jones - Editor (5/13/2009)
We don't allow post deletions. We do allow editing.


duly noted, thanks.



John Sansom (@sqlBrit) | www.johnsansom.com
Post #716179
Posted Wednesday, May 13, 2009 2:46 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, June 16, 2014 4:03 AM
Points: 488, Visits: 403
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?
Post #716446
Posted Wednesday, May 20, 2009 3:13 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 18, 2014 2:25 AM
Points: 1,262, Visits: 3,419
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!



============================================================
SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #720398
Posted Wednesday, June 10, 2009 1:58 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, March 24, 2014 11:24 AM
Points: 1,145, Visits: 105
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.



Post #732596
Posted Wednesday, June 10, 2009 2:31 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:48 PM
Points: 23,015, Visits: 31,536
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.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #732610
« Prev Topic | Next Topic »

Add to briefcase «««23456»»

Permissions Expand / Collapse