日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

sqlserver2008 创建支持文件流的数据库

發(fā)布時(shí)間:2023/12/9 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 sqlserver2008 创建支持文件流的数据库 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
第一步打開sqlserver數(shù)據(jù)庫filestream特性 How to: Enable FILESTREAM(12個(gè)步驟)

?

Before you can start to use FILESTREAM, you must enable FILESTREAM on the instance of the SQL Server Database Engine. This topic describes how to enable FILESTREAM by using SQL Server Configuration Manager.

To enable and change FILESTREAM settings

  • On the?Start?menu, point to?All Programs, point to?Microsoft SQL Server 2008, point toConfiguration Tools, and then click?SQL Server Configuration Manager.

  • In the list of services, right-click?SQL Server Services, and then click?Open.

  • In the?SQL Server Configuration Manager?snap-in, locate the instance of SQL Server?on which you want to enable FILESTREAM.

  • Right-click the instance, and then click?Properties.

  • In the?SQL Server Properties?dialog box, click the?FILESTREAM?tab.

  • Select the?Enable FILESTREAM for Transact-SQL access?check box.

  • If you want to read and write FILESTREAM data from Windows, click?Enable FILESTREAM for file I/O streaming access. Enter the name of the Windows share in the?Windows Share Name?box.

  • If remote clients must access the FILESTREAM data that is stored on this share, select?Allow remote clients to have streaming access to FILESTREAM data.

  • Click?Apply.

  • In SQL Server Management Studio, click?New Query?to display the Query Editor.

  • In Query Editor, enter the following Transact-SQL?code:

    EXEC sp_configure filestream_access_level, 2 RECONFIGURE
  • Click?Execute.

    ?

  • ?

    ?第二步 執(zhí)行創(chuàng)建數(shù)據(jù)庫的sql語句

    ?

    ?

    ?(在執(zhí)行中可能會(huì)遇到 系統(tǒng)拒絕訪問的問題,如果沒有問題那最好了,解決問題這塊就不用看了

    ????? 解決此問題請看這里http://connect.microsoft.com/SQLServer/feedback/details/435855/operating-system-error-2147024891-0x80070005-access-is-denied?????

    ????? 注意他給了不同操作系統(tǒng)的熱補(bǔ)丁 ,選擇適合自己系統(tǒng)的。

    ????? 這個(gè)是windows server 2003的?http://support.microsoft.com/kb/973573.

    ????? 這個(gè) 是 xp的http://support.microsoft.com/?id=978835

    - 創(chuàng)建數(shù)據(jù)庫
    Use Master
    Go
    --數(shù)據(jù)庫文件路徑(如果有多級文件夾,需要先手動(dòng)預(yù)先建立才行)。
    --數(shù)據(jù)庫名稱:EGDB
    --數(shù)據(jù)庫文件名稱:EGDB_Data.mdf
    --數(shù)據(jù)日志文件名稱:EGDB_Data_Log.ldf
    --文件流數(shù)據(jù)名稱:EGDB_FileStreamData
    --文件組名稱:EGDB_FileGroup
    --文件流名稱:EGDB_FileStream
    --
    IF EXISTS (SELECT name FROM sys.databases WHERE name = N'EGDB_HZZ')
    DROP DATABASE EGDB_HZZ
    GO

    ?USE Master
    GO
    CREATE DATABASE EGDB_HZZ ON PRIMARY
    ?( NAME = EGDB_HZZ_Data,
    ?FILENAME = N'D:\db\SQL_EGDB\EGDB_HZZ_Data.mdf',
    ?SIZE = 10MB,
    ?FILEGROWTH = 10MB),
    FILEGROUP EGDB_HZZ_FileGroup
    ?( NAME = EGDBFileStream_Data,
    ?FILENAME = N'D:\db\SQL_EGDB\EGDB_Data.ndf',
    ?SIZE = 10MB,
    ?FILEGROWTH = 5MB),
    FILEGROUP EGDB_HZZ_FileStream CONTAINS FILESTREAM
    ?( NAME = EGDB_HZZ_FileStream,
    ?FILENAME = N'D:\db\SQL_EGDB\EGDB_FileStreamData')
    LOG ON
    ?( NAME = EGDB_HZZ_Data_Log,
    ?FILENAME = N'D:\db\SQL_EGDB\EGDB_Data_Log.ldf',
    ?SIZE = 5MB,
    ?MAXSIZE = 500MB,
    ?FILEGROWTH = 5MB);
    GO

    第三步創(chuàng)建數(shù)據(jù)表

    use EGDB_HZZ
    if exists (select 1
    ??????????? from? sysobjects
    ?????????? where? id = object_id('dbo.SYS_FILES')
    ??????????? and?? type = 'U')
    ?? drop table dbo.SYS_FILES
    go


    /*==============================================================*/
    /* Table: SYS_FILES???????????????????????????????????????????? */
    /*==============================================================*/
    create table dbo.SYS_FILES (
    ?? FILE_ID????????????? uniqueidentifier???? not null default newid(),
    ?? FILE_NAME??????????? varchar(100)???????? null default ' ',
    ?? FILE_CONTENT_B?????? varbinary(max)?????? NULL,
    ?? FILE_CONTENT_C?????? varchar(max)???????? null default ' ',
    ?? FILE_SIZE??????????? float??????????????? null,
    ?? FILE_TYPE??????????? varchar(50)????????? null default ' ',
    ?? FILE_SERVER_PATH???? varchar(200)???????? null default ' ',
    ?? FILE_REMARK????????? varchar(300)???????? null default ' ',
    ?? FILE_SYS_TIME??????? datetime???????????? null default getdate(),
    ?? constraint PK_SYS_FILES primary key (FILE_ID)
    )
    ?

    ?

    轉(zhuǎn)載于:https://www.cnblogs.com/hbhzz/p/3209974.html

    總結(jié)

    以上是生活随笔為你收集整理的sqlserver2008 创建支持文件流的数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。