0

I copied a .CSV file dataset_with_pred2.csv into the filestream folder in SQL Server. Is it possible to read it into table?

Now, everything I can do is to retrieve the .csv file into string via:

select cast(file_stream as varchar(max)) 
from [dbo].[MODEL_FILETABLE] with (READCOMMITTEDLOCK) 
where name = 'dataset_with_pred2.csv'

It returns comma separated values.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alex Ivanov
  • 657
  • 1
  • 8
  • 17
  • 3
    look up BULK INSERT, BCP – Mitch Wheat May 06 '20 at 08:28
  • 2
    "_I copied csv-file "dataset_with_pred2.csv" into filestream folder in SQL-server._" That's not how filestream folders work - the files in there are managed by SQL Server itself. – AlwaysLearning May 06 '20 at 08:55
  • Mitch Wheat, AlwaysLearning, thank you very much. If I understood you correctly, I shoud use something like: BULK INSERT Sales.Orders FROM '\\server\folder\dataset_with_pred2.csv' WITH ( FORMAT='CSV') regardless if the folder has filestream type. – Alex Ivanov May 07 '20 at 09:50
  • 1
    "I copied a .CSV file dataset_with_pred2.csv into the filestream folder" - you don't need to do that. The file can be anywhere on the filesystem – Mitch Wheat May 10 '20 at 03:35

0 Answers0