Thursday, October 20, 2016

Sql Server Filetable and Entity Framework





CREATE PROCEDURE SFilesDelete (@fId uniqueidentifier)
AS
BEGIN
SET NOCOUNT ON;
DELETE from SFiles where stream_id = @fId;  
END
GO

ALTER PROCEDURE [dbo].[SFilesInsert]
@fname nvarchar(255)
,@fData varbinary(max)
AS
BEGIN

Declare @fid uniqueidentifier = NEWID();
    INSERT INTO SFiles (stream_id, file_stream, name) VALUES (@fId ,@fdata,@fname);
    SELECT stream_id, file_stream.PathName() as unc_path FROM SFiles where stream_id = @fId
END

No comments: