SQLserver数据库基础
1控制数据库的服务 运行cmd 在控制面板输入netstart MSSQLserver(启动数据库服务) 在控制面板输入netstop MSSQLserver(关闭数据库服务) 在控制面板输入netcontinueMSSQLserver(继续数据库服务) 【字母大小写均可】 2数据库文件类型 .Mdf是数据库文件 .Ldf 是
1·控制数据库的服务
运行 cmd
在控制面板输入 net start MSSQLserver (启动数据库服务)
在控制面板输入 net stop MSSQLserver (关闭数据库服务)
在控制面板输入 net continue MSSQLserver (继续数据库服务)
【字母大小写均可】
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
4·创建数据库、表
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--->确定
数据库的还原
右键数据库中的还原数据库--->目标数据库的名字要和备份的数据库名字一致--->源设备、选择备份后数据库的路径、选择并确定
8·分离与附加
数据库的分离
右键要分离的数据库名--->任务--->分离(删除链接、更新统计信息)--->确定
数据库的附加
右键数据库附加--->添加(寻找数据库路径)--->确定

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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.

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

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.

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

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.

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.

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.

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())
