在SQL Server中启用FileStream
最近在研究在数据库中存储大数据文件,看到了FileStream 这个功能,记录下来以备后用 FileStream 一般在安装的时候默认是不启用的,如果你留意的话,在选择数据库文件路径那个窗口,有一个标签是FileStream. 如果在安装的时候你没有启用,安装后可以通过以下
最近在研究在数据库中存储大数据文件,看到了FileStream 这个功能,,记录下来以备后用
FileStream 一般在安装的时候默认是不启用的,如果你留意的话,在选择数据库文件路径那个窗口,有一个标签是"FileStream".
如果在安装的时候你没有启用,安装后可以通过以下设置来开启FileStream 功能。
1. 打开 SQL Server 配置管理器, 在SQL server 服务下找到你要启用的SQL Server服务(默认实例一般是 MSSQLServer),右击该服务,选择属性,在属性窗口你可以看到FileStream 标签,选中" 针对 Transact-SQL 访问启用 FILESTREAM"
2.执行以下命令在ssms
EXEC sp_configure filestream_access_level, 2
RECONFIGURE
3.创建支持FileStream 的数据库,
[sql]
CREATE DATABASE test
ON
( NAME = test_dat,
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLDATAtestdat.mdf' ),
FILEGROUP testGroup1 CONTAINS FILESTREAM
( NAME = testgroup_dat ,
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLDATAtestGroup1.ndf')
LOG ON
( NAME = Sales_log,
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLDATAtestlog.ldf' ) ;
当然你也可以用以下脚本,在已存在的数据库添加一个文件组用于支持FileStream.
[sql]
ALTER database test
ADD FILEGROUP FileStreamRecord
CONTAINS FILESTREAM
GO
--Add a file for storing database photos to FILEGROUP
ALTER database test
ADD FILE
(
NAME= 'FileStreamRecord',
FILENAME = 'D:Program FilesMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLDATATestFileStreamRecord.ndf'
)
TO FILEGROUP FileStreamRecord
GO
4. 创建可以存储FileStream 的数据表
CREATE TABLE FileStreamRecording
[sql]
(
ID int,
RowGuidColumn UNIQUEIDENTIFIER
NOT NULL UNIQUE ROWGUIDCOL,
FILESTREAMColumn varbinary(MAX) FILESTREAM
);
[sql]
[sql]
5.使用
[sql]
INSERT INTO FileStreamRecording VALUES(1, NEWID(), 0x00);
INSERT INTO FileStreamRecording VALUES(2, NEWID(), 0x00);
INSERT INTO FileStreamRecording VALUES(3, NEWID(), 0x00);
GO
SELECT FILESTREAMColumn.PathName() AS 'PathName' FROM FileStreamRecording;
具体的使用可参考联机帮助或在线帮助。

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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











WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

When the Windows 11 taskbar overflow feature stops working, users lose important customization options. This is because the feature allows you to add as many applications as you want to the taskbar and launch them easily. While this problem can be frustrating, it's not the most difficult to solve. In this comprehensive guide, we’ve prepared foolproof methods to get the taskbar overflow feature working properly again. Why doesn't taskbar overflow work on Windows 11? As users have reported, there are several factors that can cause Taskbar Overflow to not work on Windows 11. Here are some noteworthy reasons: Outdated PC: Outdated operating system is the main cause of this problem. If you are using preview body higher than Windows 11

At its annual developers conference, Apple unveiled the next generation of operating systems to power its suite of devices. As usual, iOS 17 is at the center of all the major changes, with features like live voicemail, message transcription, live stickers, standby mode, full-screen live activities, interactive widgets, and more. One of the features that stands out among these new additions is Screen Distance. This is a health-centric feature focused on preventing eye strain and myopia on your iPhone screen. In this article, we will explain what screen distance is and how to enable it in iOS17. What is screen distance on iOS17? As part of the new health features introduced in iOS 17, Apple is offering a screen distance feature to help users anticipate

iOS 17 has been the talk of the town since Apple first previewed it at WWDC2023. The new operating system brings many changes and new features, including the much-anticipated standby. Standby is a great way to use your iPhone when it's idle and charging, allowing you to view information at a glance, including reminders, clock, upcoming events, calendar, weather information, and more. This information is displayed using extra-large widgets so that everything can be seen when the iPhone is idle and charging on the nightstand or workbench. So, if you want to make the most of the standby feature, then you can enable and use it on your iPhone. How to enable standby on iOS17 Here's how to enable standby on an iPhone running iOS17

If you've ever wanted to share clipboard items between Windows and Android, Clipboard Sync is your friend. Using Clipboard History for Windows and the Swiftkey Keyboard app on Android, any items you copy to your clipboard will appear on both devices' clipboards, as long as both devices are connected to the same Microsoft account. Here's how to set it up. To set up clipboard sync between Android and Windows 11, you have to do two things: turn on clipboard history sync on Windows and install the Microsoft Swiftkey keyboard on Android (using the same Micr as on your PC

On the occasion of releasing the build 26040 version of Windows Server, Microsoft announced the official name of the product: Windows Server 2025. Also launched is the Windows11WindowsInsiderCanaryChannel version build26040. Some friends may still remember that many years ago someone successfully converted Windows NT from workstation mode to server mode, showing the commonalities between various versions of Microsoft operating systems. Although there are clear differences between Microsoft's current version of the server operating system and Windows 11, those who pay attention to the details may be curious: why Windows Server updated the brand,

How to modify the default name of nginx, you can disguise it a little, or you can install Tip: Generally, modifications are made before nginx is compiled. After modification, the code needs to be recompiled as follows: scr/core/nginx.conf#definenginx_version"1.4.7"#definenginx_ver"nginx/"n

Many users are not familiar with how to enable ftp server in Everything when using Everything software? Next, the editor will bring you the method to enable ftp server in Everything. Let us take a look below. Open the everything software, enter the main interface of the software, and click on the tool option pointed by the arrow above. In the drop-down column of tool options, select the option bar pointed by the arrow to enter the settings page. Enter the settings page, and in the column on the left, select the ETP/FTP server option pointed by the arrow to set it. Enter the ETP/FTP server page, check the Enable ETP/FTP server option pointed by the arrow, and then click
