Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Creating database

Author  Topic 

gsashwin
Starting Member

2 Posts

Posted - 2010-07-05 : 18:41:59
Hi All,

I am pretty new to SQL Server 2008 and i got stuck while creating a new database which includes a primary filegroup and user defined filegroup as well as to create a log file. My syntax goes like this.

CREATE DATABASE SQL2008SBS ON PRIMARY
( NAME = 'SQL2008SBS', FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SQL2008SBS.mdf',
SIZE = 3MB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%),
FILEGROUP FG1 DEFAULT ( NAME = 'SQL2008SBSFG1_Dat1' ,
FILENAME = 'C: \Program Files\Microsoft SQL Server\MSSQL10. MSSQLSERVER\MSSQL\DATA\SQL2008SBS_1.ndf' ,
SIZE = 2MB , MAXSIZE = UNLIMITED, FILEGROWTH = 2MB) ,
(NAME = 'SQL2008SBSFG1_Dat2' , FILENAME = 'C: \Program Files\Microsoft SQL Server\MSSQL10. MSSQLSERVER\MSSQL\DATA\SQL2008SBS_2. ndf' ,
SIZE = 2MB , MAXSIZE = UNLIMITED, FILEGROWTH = 2MB) ,
(NAME = 'SQL2008SBSFG1_Dat3' , FILENAME = 'C: \Program Files\Microsoft SQL Server\MSSQL10. MSSQLSERVER\MSSQL\DATA\SQL2008SBS_3. ndf' ,
SIZE = 2MB , MAXSIZE = UNLIMITED, FILEGROWTH = 2MB)
LOG ON ( NAME = 'SQL2008SBS_Log', FILENAME = 'C: \Program Files Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SQL2008SBS.ldf' ,
SIZE = 2MB , MAXSIZE = UNLIMITED , FILEGROWTH = 10MB )
GO


However i get the following error when i am trying to execute the above code. I know that this can be done graphically too but i wanted to do it the SQL Command way. Somone please help me. Thanks in advance.


Msg 5105, Level 16, State 2, Line 1
A file activation error occurred. The physical file name 'C: \Program Files\Microsoft SQL Server\MSSQL10. MSSQLSERVER\MSSQL\DATA\SQL2008SBS_1.mdf' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-06 : 01:27:15
look for blank spaces between C: and \Program...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-07-06 : 01:42:26
There's a space in some of your file names, including the one that the error mentions.

C: \Program Files\Microsoft SQL Server\MSSQL10. MSSQLSERVER\MSSQL\DATA



--
Gail Shaw
SQL Server MVP
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-06 : 01:52:35
eagle eye


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -