How to Update FILESTREAM Data in SQL Server

To update inserted FILESTREAM data row in a FILESTREAM Table created using the following code:

CREATE TABLE [dbo].[FS_Table]
(
[Id] [int] IDENTITY(1,1) NOT NULL,
[UI] UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL UNIQUE,
[FS_Data] [varbinary](max) FILESTREAM NULL
)

...use this T-SQL command (it will replace an existing image with Id = 1 in the dbo.FS_Table in the FS_Database with the image_001a.jpg file from D:\temp\ folder):

Use FS_Database
GO
UPDATE [dbo].[FS_Table]
SET FS_Data = (SELECT * FROM OPENROWSET(BULK N'D:\temp\image_001a.jpg', SINGLE_BLOB) AS Image001a)
WHERE Id = 1
GO

Update_FILESTREAM_data

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">