Results 1 to 11 of 11
  1. #1
    Join Date
    Jan 2008
    Posts
    186

    Unanswered: New to MSSQL - Creating a database

    Hello all,

    I'm new to MS SQL server.

    When using the "Management Studio" how do I create a database? When it starts up, I only seem to have the option of connecting to a database, while not actually creating one

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Right click Database and select New Database.

    Or do it in code:
    Code:
    CREATE DATABASE myDatabase
    Full syntax in Books Online.

  3. #3
    Join Date
    Jan 2008
    Posts
    186
    Hi, thanks for the reply.

    Hmm, I don't see a "Database" option where I can right-click on... Is there a panel or view that I need to unhide? (see attached picture)
    Attached Thumbnails Attached Thumbnails screen.JPG  

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You aren't connected to an instance. Click on connect and connect to a SQL Server instance. The object explorer (left pane) will fill up with objects. One of there is "Databases".

  5. #5
    Join Date
    Jan 2008
    Posts
    186
    Quote Originally Posted by pootle flump
    You aren't connected to an instance. Click on connect and connect to a SQL Server instance. The object explorer (left pane) will fill up with objects. One of there is "Databases".
    So are you talking about this dialog? (see attached image)

    The problem is I don't know what to put for "server name" because I didn't create a server... Should I have created one first? If so, how do I do it?

    Thanks a lot for your help with this
    Attached Thumbnails Attached Thumbnails login.JPG  

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You have installed the SQL Server database engine though right? That is what it means by the server - it is actually the instance name.

  7. #7
    Join Date
    Jan 2008
    Posts
    186
    I just downloaded the evaluation version from Microsoft's website (SQLEVAL.EVE). I'm fairly certian the engine would be included in the install.

    How would I check if I've installed the engine?

    When I open up the add-remove programs dialog, I see "Microsoft SQL Server 2005" and the size is 848MB -- if that's any indication

  8. #8
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Look in the Services applet and see what is listed as SQL SERVER for a service name.

  9. #9
    Join Date
    Jan 2008
    Posts
    186
    Attached is a semi-expanded layout of my SQL Server directory tree... I expanded some of the items I thought might be of some indication

    (Not sure if this is any help?)
    Attached Thumbnails Attached Thumbnails tree.JPG  

  10. #10
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    No, it is not any help. Go to the services applet in Control Panel->Administrative Tools.

  11. #11
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    oh for the love of

    Just script an existing

    Code:
    IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'Northwind')
    	DROP DATABASE [Northwind]
    GO
    
    CREATE DATABASE [Northwind]  ON (NAME = N'Northwind', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\northwnd.mdf' , SIZE = 42, FILEGROWTH = 10%) LOG ON (NAME = N'Northwind_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\northwnd.ldf' , SIZE = 13, FILEGROWTH = 10%)
    GO
    
    exec sp_dboption N'Northwind', N'autoclose', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'bulkcopy', N'true'
    GO
    
    exec sp_dboption N'Northwind', N'trunc. log', N'true'
    GO
    
    exec sp_dboption N'Northwind', N'torn page detection', N'true'
    GO
    
    exec sp_dboption N'Northwind', N'read only', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'dbo use', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'single', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'autoshrink', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'ANSI null default', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'recursive triggers', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'ANSI nulls', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'concat null yields null', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'cursor close on commit', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'default to local cursor', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'quoted identifier', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'ANSI warnings', N'false'
    GO
    
    exec sp_dboption N'Northwind', N'auto create statistics', N'true'
    GO
    
    exec sp_dboption N'Northwind', N'auto update statistics', N'true'
    GO
    
    if( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) )
    	exec sp_dboption N'Northwind', N'db chaining', N'false'
    GO
    
    use [Northwind]
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •