April 11, 2013 at 8:01 pm
Just moved from learning mysql to SQL Server 2012, and already having an issue.
Here is my code:
CREATE DATABASE ApressFinancial ON PRIMARY
( Name = N' ApressFinancial ',
FILENAME = N' C:\Program Files\Microsft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.mdf' ,
SIZE = 4096KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME= N'ApressFinancial_log',
FILENAME= N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL_log.ldf' ,
SIZE = 1024KB, MAXSIZE = 2048GB, FILEGROWTH = 10%)
COLLATE SQL_LATIN1_General_CP1_CI_AS
GO
Here is my error
Msg 5105, Level 16, State 2, Line 1
A file activation error occurred. The physical file name ' C:\Program Files\Microsft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.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.
April 11, 2013 at 8:48 pm
Looks like a typo in your file path
CREATE DATABASE ApressFinancial ON PRIMARY (
Name = N' ApressFinancial ',
FILENAME = N' C:\Program Files\Microsft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.mdf' ,
SIZE = 4096KB ,
MAXSIZE = UNLIMITED,
FILEGROWTH = 1024KB )
LOG ON (
NAME= N'ApressFinancial_log',
FILENAME= N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL_log.ldf' ,
SIZE = 1024KB,
MAXSIZE = 2048GB,
FILEGROWTH = 10%)
COLLATE SQL_LATIN1_General_CP1_CI_AS
"Microsft SQL Server" is missing an "o"
April 11, 2013 at 9:04 pm
wow. I'm an idiot. Thank you so much
April 11, 2013 at 9:21 pm
No worries, it happens to all of us at some point 🙂
Also, here are a couple of newbie-unfriendly defaults that you may wish to change:
1. Please consider moving the database to somewhere other than the C: drive if at all possible
2. Either set the database Recovery Model to Simple, or set up regular transaction log backups
April 11, 2013 at 9:34 pm
Ah ok I thought it would be best to start practicing with full recovery as in a production environment but I get your point starting out.
April 12, 2013 at 8:11 am
Just tried it again.
Msg 5105, Level 16, State 2, Line 1
A file activation error occurred. The physical file name ' C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\APRESSFINANCIAL.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.
Does it have anything to do with the whole sql server folder being read only?
April 12, 2013 at 12:53 pm
anyone?
April 12, 2013 at 1:19 pm
You've got a space before C:. ' C:\' chould be 'C:\' Directories never have a space at the beginning
btw, we're all volunteers here, we all post in our spare time, we don't work for SSC.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 12, 2013 at 2:09 pm
Oh I know don't mistake my impatience for arrogance or whatever. You guys are amazing helpers. I just was getting really frustrated. And it worked so you've done me a great favor. I need to learn how to really look at the syntax, I just hope it's rookie mistakes.
April 12, 2013 at 4:07 pm
This may be a stupid question but everytime I make a new command or query with T-SQL, do I have to open up a new query window or can I just delete the previous query and type in the blank of said query?
April 15, 2013 at 2:44 pm
bump
April 15, 2013 at 3:34 pm
dob111283 (4/12/2013)
This may be a stupid question but everytime I make a new command or query with T-SQL, do I have to open up a new query window or can I just delete the previous query and type in the blank of said query?
No, you don't have to open a new query window. You don't even have to delete what is already in the current window. You can type a new query, hightlight it and execute it. I do it all the time. Sometimes I'll also comment previous code so I don't have to highlight just the code I want. I usually do this when I need the code in the query window for things I am working on.
April 15, 2013 at 4:49 pm
dob111283 (4/15/2013)
bump
At this point, my recommendation is to press the {f1} key and begin reading Books Online for answers to some of these questions. It will not only help you now, but you'll become more familiar with it each time you use it and you'll be able to find much more complicated things in the future without resorting to "Bumps". 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
April 15, 2013 at 5:08 pm
Thank you for both answers. I'll work on it.
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply