Archive

Posts Tagged ‘sql server 2008’

Create new Table in SQL Server 2008 R2

October 31, 2010 Leave a comment

In this post, I’ll be guiding you how to create a new table in Microsoft SQL Server 2008 R2. In this demo, I’ll be using Microsoft SQL Server 2008 R2 Express Edition. I assume you already have a existing database. If you do not, please see this post first.

Now, lets get started.

  1. Run the Microsoft SQL Server Management Studio and login to your database engine.
  2. On the “Object Explorer” expand “Databases” menu, and then also expand your database menu by clicking on the “+” icon next to each respective folders.
  3. Right-Click on “Tables” and select “New Table”.
  4. A new window will then comes up next to the “Object Explorer”. Now enter your column name, data type, and allow nulls.
  5. You can make a column as a Primary Key by just keeping your cursor on the column that you want to make it a Primary Key, and then click on the Key icon on the Toolbar.
  6. When you’re done, hit the “Save” button on the toolbar or just simply press "Ctrl+S” to save. Then Microsoft SQL Server will prompt you to give your table a name. Enter a name and click “OK"04-CreateNewTable2

That’s it. You have just created a new table in your database in Microsoft SQL Server 2008.

Creating a new database in Microsoft SQL Server 2008 R2

October 31, 2010 1 comment

In this post, I’ll be guiding you how to create your first database with Microsoft SQL Server 2008 R2. For this demo, I’ll be using Microsoft SQL Server 2008 R2 Express Edition.

First, you have to download and install Microsoft SQL Server 2008 R2 Express Edition. You can either download the 32-bit version or the 64-bit version. [ Download here ]

*NOTE: Download the version with Management Tools.

 

After you have completed your download and installed in on your PC, lets get started.

  1. Click start, and search for “SQL Server Management Studio” and run the program.
  2. You will now be prompt to login into your Database Engine. Depending on what type of login method you specified during the installation, you can either logon using Windows Authentication or SQL Server Authentication. In my case, I’ll be using Windows Authentication.
    01-ConnectToDatabaseEngine
  3. After you have successfully logged in, click on “Databases” to see all your existing Databases. If this is your fresh installation, you will only be able to see “System Databases” folder there.
    02-ListOfExistingDatabase
  4. Now, to create your own database, Right-Click on “Databases” on the left column, and select “New Database..”. Then, you should see a pop-up window to create a new database.
    03-CreateNewDatabase2
  5. Enter your database name. For our case now, we’ll just leave other settings with the default values. If you already have some experience with Microsoft SQL Server, you can proceed to do your preferred settings. Hit “OK” after you have done all your settings and you’ll see your database listed on the left panel under “Databases”.
    03-CreateNewDatabase3
  6. Now, let’s see what do we have in our new database here by clicking on the “+” icon on the left panel next to our database name. You should be able to see 8 different types of folders, such as “Database Diagrams”, “Tables”, and etc.

And that’s it. You have just created a new database with Microsoft SQL Server 2008 R2.

Additional:

If you’re wondering where is your database file located in your PC, by default it’s located in:

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