Dogodek
31. mar., 23h - 2. apr., 23h
Največji dogodek učenja SQL, Fabric in Power BI. 31. marec - 2. april Če želite shraniti 400 $, uporabite kodo FABINSIDER.
Registrirajte se danesTa brskalnik ni več podprt.
Izvedite nadgradnjo na Microsoft Edge, če želite izkoristiti vse prednosti najnovejših funkcij, varnostnih posodobitev in tehnične podpore.
Applies to:
SQL Server
This topic shows how to create a database that supports FILESTREAM. Because FILESTREAM uses a special type of filegroup, when you create the database, you must specify the CONTAINS FILESTREAM clause for at least one filegroup.
A FILESTREAM filegroup can contain more than one file. For a code example that demonstrates how to create a FILESTREAM filegroup that contains multiple files, see CREATE DATABASE (SQL Server Transact-SQL).
In SQL Server Management Studio, click New Query to display the Query Editor.
Copy the Transact-SQL code from the following example into the Query Editor. This Transact-SQL code creates a FILESTREAM-enabled database called Archive.
Opomba
For this script, the directory C:\Data must exist.
To build the database, click Execute.
The following code example creates a database that is named Archive
. The database contains three filegroups: PRIMARY
, Arch1
, and FileStreamGroup1
. PRIMARY
and Arch1
are regular filegroups that cannot contain FILESTREAM data. FileStreamGroup1
is the FILESTREAM
filegroup.
CREATE DATABASE Archive
ON
PRIMARY ( NAME = Arch1,
FILENAME = 'C:\data\archdat1.mdf'),
FILEGROUP FileStreamGroup1 CONTAINS FILESTREAM ( NAME = Arch3,
FILENAME = 'C:\data\filestream1')
LOG ON ( NAME = Archlog1,
FILENAME = 'C:\data\archlog1.ldf')
GO
For a FILESTREAM
filegroup, FILENAME
refers to a path. The path up to the last folder must exist, and the last folder must not exist. In this example, c:\data
must exist. However, the filestream1
subfolder cannot exist when you execute the CREATE DATABASE
statement. For more information about the syntax, see CREATE DATABASE (SQL Server Transact-SQL).
After you run the previous example, a filestream.hdr file and an $FSLOG folder appears in the c:\Data\filestream1 folder. The filestream.hdr file is a header file for the FILESTREAM container.
Pomembno
The filestream.hdr file is an important system file. It contains FILESTREAM header information. Do not remove or modify this file.
For existing databases, you can use the ALTER DATABASE statement to add a FILESTREAM filegroup.
CREATE DATABASE (SQL Server Transact-SQL)
ALTER DATABASE (Transact-SQL)
Dogodek
31. mar., 23h - 2. apr., 23h
Največji dogodek učenja SQL, Fabric in Power BI. 31. marec - 2. april Če želite shraniti 400 $, uporabite kodo FABINSIDER.
Registrirajte se danesUsposabljanje
Modul
Create a lake database in Azure Synapse Analytics - Training
Create a lake database in Azure Synapse Analytics
Potrdilo
Microsoft Certified: Azure Database Administrator Associate - Certifications
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.
Dokumentacija
Create a Table for Storing FILESTREAM Data - SQL Server
Learn how to create a table for storing FILESTREAM data in SQL Server. See which columns and attributes to use in the Transact-SQL code.
Avoid conflicts - FILESTREAM database operations - SQL Server
Applications that read or write FILESTREAM blob data can encounter conflict errors with Transact-SQL statements. Learn how to avoid these types of conflicts.
Enable and configure FILESTREAM - SQL Server
To use FILESTREAM, first enable it on the SQL Server Database Engine instance. Learn how to enable FILESTREAM by using SQL Server Configuration Manager.