Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

Read any physical file (.xls , .xlsx, tiff, pdf, txt ...etc ) and write in to Sql Table ?

$
0
0

Hi,

I have lot of files in the directory is filling lot of space in the directory. So we are planning to move those files to sql table as content.

Ex: file path : \\server\foldername\file.doc.

Can you please help me to do read file and write in to [image] (or) varbinary data type  column in the sql table without storing file anywhere.

I have read about filetable in the sql server 2012, but it is also storing file physically ( D:\FileTable_DocumentStore ) .i.e


File table creation :

USE [master]
GO

CREATE DATABASE SQLDocumentStoreDB
ON PRIMARY
(NAME = SQLDocumentStoreDB
,FILENAME = 'D:\Program Files\Microsoft SQL Server\DBData\SQLDocumentStoreDB.mdf'),
FILEGROUP FileStreamFG CONTAINS FILESTREAM
(NAME = SQLDocumentStoreFileTable
,FILENAME = 'D:\FileTable_DocumentStore' ) --Folder location
LOG ON
(NAME = SQLDocumentStoreDB_Log
,FILENAME = 'D:\Program Files\Microsoft SQL Server\DBLogs\SQLDocumentStoreDB_Log.ldf')
WITH FILESTREAM
--Gives full non-transactional access to the share/ directory
(NON_TRANSACTED_ACCESS = FULL
,DIRECTORY_NAME = N'DocumentStore');
GO

Can you please suggest that how to convert any physical file to [image] data type (or) varbinary ? or Can you please provide any store procedure  ?

Thank you.




Viewing all articles
Browse latest Browse all 4729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>