All,
The link shows how to create a format file using BCP. This assumes that the data is always extracted from a SQLServer table.
We receive lot of csv files from our business partners for which we cannot generate the format file and we plan to use them using OPENROWSET with the csv files being placed in Azure Blob Storage. Does anyone know how to generate the format file for a given csv file other than creating one manually?
In the below script, I manually created the format file currency.fmt for the csv data file currency.csv
Thanks,
rgn
CREATE EXTERNAL DATA SOURCE pocBlobStorage WITH ( TYPE = BLOB_STORAGE, LOCATION = 'https://eventhubstore.blob.core.windows.net/datasets', CREDENTIAL= sqlblob); -- 2.4. Query remote file SELECT * FROM OPENROWSET(BULK 'currency.csv', DATA_SOURCE = 'pocBlobStorage', FORMATFILE='currency.fmt', FIRSTROW=2, FORMATFILE_DATA_SOURCE = 'pocBlobStorage') as D Inner Join [dbo].[State] C On C.[id] = D.CurrencyKey