_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈 |
FrontPage › FileStreamAccess
|
|
필자의 노트북에 설치된 버전이 영문 버전이다. 영어도 조낸 못하는 놈이 영문 버전 설치해 놓고 삽질한다. 그림이 짜증나도 이해하기 바란다.
[edit]
1 언제 써먹나? #도움말에는 다음과 같이 쓰여져 있다.
[edit]
2 기본 설정 #다음과 같이 기본 설정을 할 수 있다.
![]() 다음으로 SSMS에서 다음과 같이 설정한다.
use master go exec sp_configure 'filestream access level', 2 go reconfigure go 마지막 매개변수는 다음과 같은 종류와 의미는 다음과 같다.
나머지 기타사항은 도움말을 참고하기 바란다. [edit]
3 데이터베이스 생성하기 #다음의 디렉토리를 생성 후 아래의 데이터베이스 생성 Script를 실행한다.
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. 만약 이런 메시지를 접하게 되면 이제까지의 과정 중 빠뜨린 부분이 있다는 뜻이 된다. */ [edit]
4 테이블 생성하기 #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 ![]() [edit]
5 FILESTREAM directory structure - where do the GUIDs come from? #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 [edit]
6 참고자료 #
|
조그만 친절이 한마디 사랑의 말이 저위의 하늘나라처럼 이 땅을 즐거운 곳으로 만든다. |