netdev2000
netdev2000

Reputation: 67

Enable and Configure FILESTREAM in Azure SQL DB

How may I store PDF file in AZURE SQL DB.

The above would require me to enable and configure FILESTREAM on the Azure SQL DB.

Currently I am getting this error when I run the Create Table query:

*Msg 40517, Level 16, State 1, Line 28
Keyword or statement option 'file stream_on' is not supported in this version of SQL Server.*
CREATE TABLE [MyDocs](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [DocId] [int] not null,
    [DocFileDat] [varbinary](max) FILESTREAM NULL,
    [DocFileType] [varchar](5) NULL,

    PRIMARY KEY CLUSTERED ([Id] ASC)
    WITH (
        PAD_INDEX = OFF,
        STATISTICS_NORECOMPUTE = OFF,
        IGNORE_DUP_KEY = OFF,
        ALLOW_ROW_LOCKS = ON,
        ALLOW_PAGE_LOCKS = ON
    ) ON [PRIMRAY]

) ON [PRIMARY] FILESTREAM_ON [FilestreamGroup1]

Upvotes: 3

Views: 5883

Answers (1)

Jovan MSFT
Jovan MSFT

Reputation: 14630

FILESTREAM is not supported in Azure SQL DB, and we don't have some confirmation that it will be added in the near future. So, I would recommend to use some alternative such as:

  • Storing whole content into in-db VARBINARY(MAX) column. This might increase your db size.
  • Store content of a file in Azure Blob storage and keep paths/urls in table. You can directly access file on blob storage via url/path, however you would need to ensure that file is deleted when associated row in database is deleted.

Upvotes: 16

Related Questions