FileStream

  • Hello.

    I have a database with 2 filestreams and i create tables with a column varbinary(max) to a filestream and others tables with that column to the other filestream.

    How do i can to know which parent filestream a table?

    Thanks.

  • I don't really understand your question. Can you elaborate?

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • Excuse me, my english is very bad.

    A BD with 2 filegroups filestream.

    One table in each filestream.

    CREATE TABLE dbo.Table1 (

    PkTable1 int NOT NULL,

    FileFS1 varbinary](max FILESTREAM NULL,

    Guia UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL unique default (newid())

    ) on [PRIMARY] filestream_on [FSTR1]

    CREATE TABLE dbo.Table2 (

    PkTable2 int NOT NULL,

    FileFS2 varbinary(max) FILESTREAM NULL,

    Guia UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL unique default (newid())

    ) on [PRIMARY] filestream_on [FSTR2]

    I need to know with a DMV for example, the filestream of each table.

    Thanks.

  • To be technical, it is not a DMV you are looking for but a catalog view. (The difference is that a catalog shows information persisted in the system catalog, while the a exposes internal data inside the SQL Server executable, but which is not stored on disk directly.)

    Here is a query:

    SELECT t.name, ds.name

    FROM sys.tables t

    JOIN sys.data_spaces ds ON t.filestream_data_space_id = ds.data_space_id

    ORDER BY t.name

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • Erland, thank you very much.

    I wanted that exactly.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply