x

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

more ▼

asked Dec 11, 2014 at 09:17 AM in Default

avatar image

nandhini.ramanujam87
11 1 1 4

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x25
x22
x10

asked: Dec 11, 2014 at 09:17 AM

Seen: 126 times

Last Updated: Dec 11, 2014 at 09:17 AM

Copyright 2018 Redgate Software. Privacy Policy