SQLServer 2005

Published on June 2016 | Categories: Types, Presentations | Downloads: 41 | Comments: 0 | Views: 242
of 15
Download PDF   Embed   Report

Comments

Content

Launching Microsoft SQL Server
To launch Microsoft SQL Server, click Start -> Programs -> Microsoft SQL Server 2005 -> SQL Server Management Studio

!hen it starts, it "ould #resent a dialog $o% that e%#ects &ou to log in

Introduction to Code
'lthough &ou "ill #erform man& of &our data$ase o#erations visuall&, some other o#erations "ill re(uire that &ou "rite code To assist "ith this, Microsoft SQL Server #rovides a code editor and various code tem#lates To o#en the editor) • • • *n the main menu, &ou can click +ile -> ,e" -> Quer& !ith -urrent -onnection *n the Standard tool$ar, click the ,e" Quer& $utton .n the *$/ect 0%#lorer, right-click the name of the server and click ,e" Quer&

This "ould create a ne" "indo" and #osition it on the right side of the interface

Executing a Statement

.n the ne%t sections and lessons, "e "ill learn various techni(ues of creating SQL statements "ith code 1& default, "hen a ne" (uer& "indo" a##ears, it is made of a "ide "hite area "here &ou "rite &our statements)

'fter "riting a statement, &ou can e%ecute it, either to make it active or sim#l& to test it To e%ecute a statement) • • • 2ou can #ress +5 *n the main menu, &ou can click Quer& -> 0%ecute *n the SQL 0ditor tool$ar, &ou can click the 0%ecute $utton • 2ou can right-click some"here in the code editor and click 0%ecute

!hen &ou e%ecute code, code editor $ecomes divided into t"o hori3ontal sections)

!hether &ou have alread& "ritten code or not, &ou can save the document of the code editor at an& time To save it) • • • 2ou can #ress -trl 4 S *n the main menu, &ou can click +ile -> Save SQLQuer&5 s(l *n the Standard tool$ar, &ou can click the Save $utton

6

.n the *$/ect 0%#lorer, right-click 7ata$ases and click ,e" 7ata$ase

2

.n the ,ame te%t $o%, t&#e MotorVehicleAdministration

Creating a Table
6 2 .n the *$/ect 0%#lorer, e%#and the 1-8 node 9click its 4 $utton: ;nder 1-8, right-click Ta$les and click ,e" Ta$le

< =

's the cursor is $linking in the first em#t& field under the -olumn ,ame column, t&#e name and #ress 0nter To save &our ta$le, on the Standard tool$ar, click the Save $utton

5 > ?

.n the -hoose ,ame dialog $o%, t&#e Emplo ees and #ress 0nter 'fter saving the ta$le, close it $& clicking its s&stem -lose $utton -lick the arro" of the com$o $o% under the 7ata T&#e column

@

Scroll do"n and select varchar from the list

A

-lick the first em#t& field under +irst,ame and t&#e MI

60 Press the do"n arro" ke& to #osition the cursor under MI 66 T&#e Last!ame and #ress the do"n arro" ke& 62 T&#e "ate#ired 6< Press Ta$ and t&#e d 6= ,otice that the datetime data t&#e is selected 65 Press 0nter three times to #osition the mouse cursor under "ate#ired 6> T&#e Emplo ee!umber and #ress the do"n arro" ke&

6? -om#lete the ta$le as follo"s)

6@ Save the ta$le

#o$ to bac%up and restore database on Microsoft SQL Server &''(
This #ost sho"s a ste#-$&-ste# guide to $acku# and restore a data$ase $et"een t"o Microsoft SQL Server 2005 instances 1& using $acku#, &ou can $acku# a data$ase "ithout interru#t an& transactions on the data$ase .n the e%am#le $elo", . "ill $acku# a data$ase from SQL Server 2005 and restore the data$ase to another SQL Server 2005 0%#ress 0dition ,o" . "ill $acku# 'dventure!orks data$ase on 1BBSQL2005 "hich runs Microsoft SQL Server 2005 to a file 6 -onnect to source server *#en Microsoft SQL Server Management Studio and connect to 1BBSQL2005

2

8ight-click on the 'dventure!orks data$ase Select Tasks -> 1acku#C

<

*n 1ack ;# 7ata$ase "indo", &ou can configure a$out $acku# information .f &ouDre not familiar these configurations, &ou can leave default values Eere are some short descri#tions 6 2 < = 7ata$ase - a data$ase that &ou "ant to $acku# 1acku# t&#e - &ou can select 2 o#tions) +ull and 7ifferential .f this is the first time &ou $acku# the data$ase, &ou must select +ull ,ame - ,ame of this $acku#, &ou can name an&thing as &ou "ant 7estination - the file that "ill $e $acku# to 2ou can leave as default 7efault "ill $acku# to F-)GProgram +ilesGMicrosoft SQL ServerGMSSQL 6GMSSQLG1acku#H -lick *B to #roceed $acku#

5

=

!ait for a "hile and &ouDll see a #o#-u# message "hen $acku# is finished

5

1ro"se to the destination, &ouDll see a $acku# file 9 $ak format: "hich &ou can co#& to other server for restore in the ne%t ste# 7efault $acku# director& is F-)GProgram +ilesGMicrosoft SQL ServerGMSSQL 6GMSSQLG1acku#H

)estore the database*
,e%t, . "ill restore the 'dventure!orks data$ase from a file that .Dve created a$ove to 1B061.I006 "hich runs Microsoft SQL Server 0%#ress 0dition 6 -o#& the $acku# file from source server to destination server .Dve co#ied into the same director& as source server

2

-onnect to destination server *#en Microsoft SQL Server Management Studio 0%#ress and connect to 1B061.I006 8ight-click on 7ata$ases Select 8estore 7ata$aseC

<

=

8estore 7ata$ase "indo" a##ears *n Source for restore, select +rom device and click J K $uttton to $ro"se file

5

*n S#ecif& 1acku#, ensure that 1acku# media is F+ileH and click 'dd

>

*n Locate 1acku# +ile, select the $acku# file This is the $acku# file that "as created in 1acku# a data$ase section and "as co#ied to this server -lick *B *B

?

1ack to 8estore 7ata$ase "indo" 6 *n 7estination for restore, select F'dventure!orksH Note: If you haven’t added the backup file on Source before (step 4-6), you on’t see the database na!e on "estination *n Source for restore, check the $o% in front of the $acku# name 9in 8estore column: -lick *B

2 <

@

!ait until restore finish and thereDll $e a #o#-u# message notif&

A

,o" &ouDll see the restored data$ase on the destination SQL Server

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close