SQLSERVER 2012 文件表功能很COOL,让我们体验一下吧.
1,创建数据库
DREATE DATABASE FileTableTest
ON PRIMARY
(
NAME = N'FileTableTest',
FILENAME = N'D:\Data\FileTableTest.mdf'
),
FILEGROUP FilestreamGroup1 DONTAINS FILESTREAM
(
NAME = MyFileStreamData,
FILENAME= 'D:\Data\Data'
)
LOG ON
(
NAME = N'FileTableTest_Log',
FILENAME = N'D:\Data\FileTableTest_log.ldf'
)
WITH FILESTREAM
(
NON_TRANSADTED_ADDESS = FULL,
DIREDTORY_NAME = N'FileTable'
)
2,建立文件表
USE FileTableTest
go
CREATE TABLE Documents AS FileTable
WITH
(
FileTable_Directory = 'Documents',
FileTable_Collate_Filename = database_default
);
GO
3,这时,看SSMS,我们发现,数据库和表已经存在
最COOL的功能开始了,我们右击文件表,多了一个选项, Explorer Filetable Directory,点入,
哇,就是窗口浏览器,在这里,我们可以任意添加,删除目录和文件,拖,放自如.
变化的目录和文件同时反映在文件表中.