"Software Introduction" SQLServer2008 basic operations

Source: Internet
Author: User
Tags import database management studio sql server management sql server management studio

0x 01 Connect to Database

Win7, first open the SQL Server Administration tool (Start menu/All Programs/microsoft SQL Servers 2008/sql Server Management Studio)

The Connect to Server dialog box pops up

1 Server type: Database Engine 2 127.0. 0.1 3 Authentication: Windows Authentication

The server name can also be "(local)", ".", "loacalhost" and use "(local)" When the network card (driver) is not installed. Note: Double quotes are not included

Authentication can also choose SQL Server Authentication, with the SA user password

When the link succeeds, the relevant database is displayed in the left Object Explorer

0x 02 New DB instance

Here we use the graphical operation of the

Click 127.0.0.1 Left "+", right-database-new database

Fill in the database name, click Finish, we have set up a database in this machine

I'm here to learn, built a database (Forstudy), the name of what the most egg hurt ....

Then new table, see, click New Table will show the central display column information

    

We can change the name to our table name (default table_1) in the "Properties" box on the right.

After setting the column information, click the key icon in the left-hand toolbar to set the primary key in the selected column, as follows

    

Ctrl+s Saving can be

In Object Explorer, click to open the table we just created (my is dbo.student)

Right-click to edit the first 200 lines to add information to the newly built table

    

At this point in the database has been built tables, we can also be added to the table to check various operations

Here to say two more sentences, the design of the table is very important, in the program development of the project must first put the database design good

Otherwise, you'll find out how fucked up it is when you need to modify the database on the way to write code ...

0x 03 manipulating Tables with query statements

Click "New Query", in the central text box input Our query statement, click on the execution can

    

0x 04 detaching a database file

Detach the database file to use the database in a different host

Close the previous query statement text box, in the "Forstudy" right-task-detach, Show detach dialog box

    

Click "OK" when we have separated the database files from the machine.

0x 05 Import Database

Can be separated must be re-imported

Right-click on "Database" in Object Explorer and tap "Attach"

Select the database file (. mdf suffix) that you want to add by selecting the Add button in the popup dialog box

Like mine is Forstudy.mdf, then click OK

    

    If you want to copy your database information to your classmate machine, that's three steps.

    1. Detaching a Database

    2. Copy the database file. mdf format

    3. Import into the database of the new host

Note: The low version of the database files to the higher version of the import should be no problem, the high version to the lower version of the compatibility of the problem, this can be tested to see!

"Software Introduction" SQLServer2008 basic operations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.