1. Run cmd to control database services. On the control panel, enter netstartMSSQLserver (start Database Service). On the control panel, enter netstopMSSQLserver (close Database Service). On the control panel, enter netcontinueMSSQLserver (continue Database Service) [uppercase/lowercase letters] 2. database file type. mdf is a database file. ldf is
1. Run cmd to control database services. On the control panel, enter netstart MSSQLserver (start Database Service). On the control panel, enter netstop MSSQLserver (close Database Service). On the control panel, enter netcontinueMSSQLserver (continue Database Service) [uppercase/lowercase letters] 2. database file type. mdf is a database file. ldf is
1. Database Control Services
Run cmd
On the Control Panel, enter net start MSSQLserver to start the database service)
On the Control Panel, enter net stop MSSQLserver (disable Database Service)
On the Control Panel, enter net continue MSSQLserver (continue Database Service)
[Uppercase/lowercase letters]
2. Database File Types
. Mdf is a database file
. Ldf is the database operation log
. Ndf is a secondary database file (generally useless)
3. Common SQL data types
Char (10) bytes, 10 indicates the byte length, which can be changed
Datetime type
Decimal () floating point type, 18 indicates the number of digits, can be changed; 0 indicates the number of Decimal places, can be changed
Float, accurate to 15 decimal places
Image Text Graphics, used to store a large amount of binary data, usually for graphics and other ole and embedded objects
Int integer
Text Graphics, used to store a large amount of Text data
Varchar (50) balanced
Varchar (MAX) connector
Xml
4. create databases and tables
Create database qq -- create a database
Go
Use qq -- select database
Go
Create table shuiguo -- create a table
(
Code int, -- column name + data type, separated by commas
Name char (10 ),
Jiage decimal (18.2 ),
Chandi char (10)
)
5. drop database qq
6. Modify the database name. The old name is followed by the new name sp_renamedb qq and abc.
7. Backup and Restoration
Database Backup
Right-click the database name ---> task ---> Backup ---> select complete Backup Type, copy only backup, backup set expiration time later than any day ---> additional ---> select path, Write File Name and suffix. bak ---> OK
Database Restoration
Right-click Restore database in the database ---> the name of the target database must be the same as that of the backup database ---> source device, select the path of the backup database, select and confirm
8. Separation and Addition
Database Separation
Right-click the name of the database to be detached ---> task ---> detach (delete link, update statistics) ---> OK
Database appending
Right-click Database attach ---> Add (find database path) ---> OK