Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming your source table looks like this:</p> <pre><code>CREATE TABLE audioFiles ( AudioID INT IDENTITY NOT NULL PRIMARY KEY, [Name] VARCHAR(50) NOT NULL, [AudioData] VARBINARY(MAX) FILESTREAM NULL, RowGuid UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL UNIQUE DEFAULT(NEWID()) ) </code></pre> <p>Then you could create a 2nd table:</p> <pre><code>CREATE TABLE audioBlobs ( AudioID INT IDENTITY NOT NULL PRIMARY KEY, [Name] VARCHAR(50) NOT NULL, [AudioData] VARBINARY(MAX) NULL, RowGuid UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL UNIQUE DEFAULT(NEWID()) ) GO </code></pre> <p>(Note that FILESTREAM is missing from the <code>AudioData</code> column in the second table ... causing the binary data to be stored on-page with the rest of the record, rather than in the separate FILESTREAM filegroup.)</p> <p>Then you can just insert the data from one table to the other:</p> <pre><code>SET IDENTITY_INSERT audioBlobs ON INSERT INTO audioBlobs (AudioID, Name, AudioData, RowGuid) SELECT AudioID, Name, AudioData, RowGuid FROM audioFiles SET IDENTITY_INSERT audioBlobs OFF </code></pre> <p>Once you're finished, you could drop your original table, and rename your new table to the original table's name:</p> <pre><code>DROP TABLE audioFiles GO EXECUTE sp_rename N'dbo.audioBlobs', N'audioFiles', 'OBJECT' GO </code></pre> <p>Alternately, you could create a 2nd <code>VARBINARY(MAX)</code> column right alongside your <code>FILESTREAM</code> column in your original table, and just update the value of the new column with the old column's data. Note that either way you go, you will more than double your total disk space usage -- double the space of your actual audio data, migrating it from your FILESTREAM filegroup to your PRIMARY filegroup (or wherever your main data file is), plus a lot of space in your transaction log.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload