question

nandhini.ramanujam87 avatar image
nandhini.ramanujam87 asked

Retreving Data from FileTable

Hi, I have a file table in the database and I have inserted two .txt files. I need to retrieve data from those files by defining column names of the output. Kindly suggest a query. `ALTER DATABASE [SQLTEST] ADD FILEGROUP test1 CONTAINS FILESTREAM; ALTER DATABASE [SQLTEST] ADD FILE ( NAME= 'test1', FILENAME = 'D:\test1\test1' ) TO FILEGROUP LOADER_DIR_FG; GO CREATE TABLE DBO.test1 AS FILETABLE WITH ( FILETABLE_DIRECTORY = 'test1', FILETABLE_COLLATE_FILENAME = database_default ); GO INSERT INTO [DBO].[test1] ([name],[file_stream]) SELECT 'TEST1DATA1.txt', * FROM OPENROWSET(BULK N'D:\TEST1\TEST1DATA1.txt', SINGLE_BLOB) AS FileData GO INSERT INTO [DBO].[test1] ([name],[file_stream]) SELECT 'TEST1DATA2.txt', * FROM OPENROWSET(BULK N'D:\TEST1\TESTDATA2.txt', SINGLE_BLOB) AS FileData GO `
filedatabase-filesfiles
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.