Home Database Mysql Tutorial SQLserver数据库基础

SQLserver数据库基础

Jun 07, 2016 pm 03:41 PM
sqlserver Base control database Serve run

1控制数据库的服务 运行cmd 在控制面板输入netstart MSSQLserver(启动数据库服务) 在控制面板输入netstop MSSQLserver(关闭数据库服务) 在控制面板输入netcontinueMSSQLserver(继续数据库服务) 【字母大小写均可】 2数据库文件类型 .Mdf是数据库文件 .Ldf 是

1·控制数据库的服务

运行 cmd

在控制面板输入  net  start    MSSQLserver   (启动数据库服务)

在控制面板输入  net  stop    MSSQLserver   (关闭数据库服务)

在控制面板输入  net  continue  MSSQLserver   (继续数据库服务)

    【字母大小写均可】

    SQLserver数据库基础

    SQLserver数据库基础

 

2·数据库文件类型

. Mdf  是数据库文件

. Ldf  是数据库操作日志

. Ndf  是数据库次要文件(一般没用)

3·sql常用的数据类型

 

Char(10)         字符型,10表示字节长度,可更改

 

Datetime     日期时间型

 

Decimal(18,0)   浮点型,18表示整数位个数,可更改;0表示小数位个数,可更改

 

Float        浮点型,精确到15位小数

 

Image        文本图形型,用于存储大量的二进制数据,通常为图形等ole和嵌入对象

 

Int          整型

 

Text             文本图形型,用于存储大量文本数据

 

Varchar(50)      字符型

 

Varchar(MAX)     字符型

 

Xml

 

 

创建数据库、表

 

  create database  qq  --创建数据库

 

  go

 

  use qq  --选择数据库

 

  go

 

  create table shuiguo --创建表

 

  (

 

  Code  int,--列名+数据类型,英文逗号分隔

 

Name  char(10),

 

Jiage  decimal(18.2),

 

Chandi  char(10)

 

  )

 

 

 

5·删除数据库  drop  database  qq

 

6·修改数据库名,前面为旧名字,后面为新名字  sp_renamedb  qq,abc

 

7·备份与还原

 

  数据库的备份

    右键数据库名--->任务--->备份--->备份类型选择完整、仅复制备份、备份集过期时间晚于随便一个天数--->附加--->选择路径、写文件名和后缀.bak--->确定

 

    SQLserver数据库基础

    SQLserver数据库基础

    

  

  数据库的还原

    右键数据库中的还原数据库--->目标数据库的名字要和备份的数据库名字一致--->源设备、选择备份后数据库的路径、选择并确定

    

    SQLserver数据库基础

 

8·分离与附加

 

  数据库的分离

    右键要分离的数据库名--->任务--->分离(删除链接、更新统计信息)--->确定

 

    SQLserver数据库基础

  数据库的附加

    右键数据库附加--->添加(寻找数据库路径)--->确定

 

    SQLserver数据库基础

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to import mdf file into sqlserver How to import mdf file into sqlserver Apr 08, 2024 am 11:41 AM

The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

How to delete sqlserver if the installation fails? How to delete sqlserver if the installation fails? Apr 05, 2024 pm 11:27 PM

If the SQL Server installation fails, you can clean it up by following these steps: Uninstall SQL Server Delete registry keys Delete files and folders Restart the computer

What is the difference between mysql and sqlserver syntax What is the difference between mysql and sqlserver syntax Apr 22, 2024 pm 06:33 PM

The syntax differences between MySQL and SQL Server are mainly reflected in database objects, data types, SQL statements and other aspects. Database object differences include the storage engine and how filegroups are specified, and the creation of indexes and constraints. Data type differences involve differences in numeric types, character types, and date and time types. SQL statement differences are reflected in result set limitations, data insertion, update and delete operations, etc. Other differences include how identity columns, views, and stored procedures are created. Understanding these differences is important to avoid errors when using different database systems.

Control Center not working in iPhone: Fix Control Center not working in iPhone: Fix Apr 17, 2024 am 08:16 AM

Imagine an iPhone without a functioning Control Center. You can't, right? If the buttons on the Control Center don't work properly, you won't be able to use your iPhone properly. The main idea of ​​Control Center is to easily access certain features directly from anywhere on your phone. In this case, these solutions will help to resolve the issue on your phone. Fix 1 – Use a Cloth to Clean Your Phone Sometimes the upper part of the display gets dirty from regular use. This may cause the Control Center to not function properly. Step 1 – Take a soft, clean microfiber cloth and clean the top half of your iPhone screen. You can also use any screen cleaning solution. Step 2 – Make sure to remove any dust, oil, or anything else from your phone’s display. After clearing phone screen

Where is the navicat database file? Where is the navicat database file? Apr 23, 2024 am 10:57 AM

The location where the Navicat database configuration files are stored varies by operating system: Windows: The user-specific path is %APPDATA%\PremiumSoft\Navicat\macOS: The user-specific path is ~/Library/Application Support/Navicat\Linux: The user-specific path is ~/ .config/navicat\The configuration file name contains the connection type, such as navicat_mysql.ini. These configuration files store database connection information, query history, and SSH settings.

What should I do if sqlserver cannot be deleted and cannot be reinstalled? What should I do if sqlserver cannot be deleted and cannot be reinstalled? Apr 05, 2024 pm 11:30 PM

The problem that SQL Server cannot be reinstalled due to incomplete deletion can be solved by following the following steps: manually delete files and registry entries; use SQL Server installation and uninstall tools; use third-party uninstall tools; check Windows Event Viewer; restart the computer; reinstall SQL Server.

How to delete database files in sqlserver How to delete database files in sqlserver Apr 05, 2024 pm 11:03 PM

To delete SQL Server database files, first stop the service, navigate to the database file home directory, delete the relevant files (.mdf, .ndf, .ldf), and finally restart the SQL Server service.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

See all articles