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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Cannot Create Database: logical file name in use?

Author  Topic 

adjones1980
Starting Member

36 Posts

Posted - 2010-01-14 : 06:33:40
I am trying to run the following...


USE [master]
GO

CREATE DATABASE [traffic_v2010] ON PRIMARY
( NAME = N'traffic_v2010', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\traffic_v2010.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'traffic_v2010', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\traffic_v2010_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO


... but I get the following error...

Msg 1828, Level 16, State 5, Line 2
The logical file name "traffic_v2010" is already in use. Choose a different name.


There is no database of that name on this server and there is no .mdf file with that name in the file system.

I can create the database with ssms but need this to work in a script I am sending to a client.

Any ideas?

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-01-14 : 07:19:44
You're referencing N'traffic_v2010' both for the data and log , change one of them

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

adjones1980
Starting Member

36 Posts

Posted - 2010-01-14 : 08:14:57
Thanks Jack. Couldn't see the wood for the trees!!


quote:
Originally posted by jackv

You're referencing N'traffic_v2010' both for the data and log , change one of them

Jack Vamvas
--------------------
http://www.ITjobfeed.com

Go to Top of Page
   

- Advertisement -