use master go exec sp_configure 'filestream access level', 2 go reconfigure go
Value | Description |
0 | FILESTREAM support for the instance is Disabled |
1 | FILESTREAM for Transact-SQL Access is Enabled |
2 | FILESTREAM for Transact-SQL and Win32 streaming access is Enabled |
use master go if exists (select name from sys.databases where name = 'filestreamdb') drop database filestreamdb go use master go create database filestreamdb on primary ( name = data01 , filename = 'c:\filestream\data01.mdf' ), filegroup filestream_fg contains filestream ( name = filestream_data01 , filename = 'c:\filestream' --蠍磯ゼ 譯殊伎 危エ覺. c:\filestream\file . ) log on ( name = log01 , filename = 'c:\filestream\log01.ldf' ) /* 覃讌 5591, 譴 16, 1, 譴 1 FILESTREAM feature is disabled. 襷 企 覃讌襯 蟆 覃 伎蟾讌 螻殊 譴 觜襴 覿覿 る 詞 . */
use filestreamdb go create table dbo.filestreamtable ( fs_id uniqueidentifier rowguidcol not null unique, fsdata varbinary(max) filestream ); insert into filestreamtable values(newid(), cast ('inserting data into filestreamtable........' as varbinary(max))) go select fs_id , CONVERT(varchar(50), fsdata) fsdata from filestreamtable /* fs_id fsdata ------------------------------------ -------------------------------------------------- E1C9F831-7305-4C18-954A-5DFEFC5DD550 inserting data into filestreamtable........ */ declare @txcontext varbinary(max) begin transaction select @txcontext = get_filestream_transaction_context() print @txcontext commit --蟆郁骸: 0x247E3F6CCDE6524FB5F20CA80003177B
SELECT o.name AS [Table], cp.name AS [Column], p.partition_number AS [Partition], r.rsguid AS [Rowset GUID], rs.colguid AS [Column GUID] FROM sys.sysrowsets r CROSS APPLY sys.sysrscols rs JOIN sys.partitions p ON rs.rsid = p.partition_id JOIN sys.objects o ON o.object_id = p.object_id JOIN sys.syscolpars cp ON cp.colid = rs.rscolid WHERE rs.colguid IS NOT NULL AND o.object_id = cp.id AND r.rsguid IS NOT NULL AND r.rowsetid = rs.rsid; GO