SQL Server 2012 Filetable directory instances using T-SQL operations

Source: Internet
Author: User
Tags new features create database

When SQL Server 2008 provides FILESTREAM to enhance SQL Server support for unstructured data with the Windows system's own APIs, SQL Server 2012 launches a Database like contained, Filetable and other exciting new features. There is no need to dwell on the features and features of filetable, this article is mainly for the filetable T-SQL Operation directory to do an example demo.

For an introduction to filetable, see msdn:http://technet.microsoft.com/zh-cn/library/ff929144.aspx

I. Prerequisites for enabling filetable

Http://technet.microsoft.com/zh-cn/library/gg509097.aspx

Use master go
EXEC sp_configure ' filestream access levels ', 2
go
reconfigure Go
--view instance-level filetable configuration
EXEC sp_configure filestream_access_level;
Go

Second, create a filetable

Use master
Go
IF EXISTS (SELECT name from sys.databases WHERE name = N ' learnfiletable ')
DROP DATABASE learnfiletable
Go
/****** Object: Database [learnfiletable] Script date:2014-04-23 9:25:32 ******/
CREATE DATABASE [learnfiletable]
Containment = NONE
On PRIMARY
(NAME = n ' learnfiletable_primary ', FILENAME = N ' E:\SQL2012Data\MyData\2012Data\LearnFileTable_Data.mdf ',
SIZE = 8128KB, MAXSIZE = Unlimited, filegrowth = 1024KB),
FILEGROUP [MYFS] CONTAINS FILESTREAM DEFAULT
(NAME = n ' learnfilefs ', FILENAME = N ' E:\SQL2012Data\MyData\2012Data\LearnFileFS ',
MAXSIZE = unlimited)
LOG on
(NAME = n ' learnfiletable_log ', FILENAME = N ' E:\SQL2012Data\MyData\2012Data\LearnFileTable_Log.ldf ',
SIZE = 8128KB, MAXSIZE = 2097152KB, filegrowth = 10%)
With FILESTREAM (non_transacted_access = full, Directory_name = N ' learnfiletable ')
Go

Third, create filetable data table

Use learnfiletable
go
CREATE TABLE MyFileTable01 as  filetable
with
(
      filetable_directory =   ' MyFileTable01 ',
      Filetable_collate_filename = Database_default
);
Go
    
select * FROM [dbo]. MYFILETABLE01;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.