Equivalent to Oracle external tables in SQL Server

oracle, sql-server

Solution

Harold Javier's answer is a good one, but you might also want to consider using OPENROWSET with the `BULK` keyword.

It is different from the external table because you don't "create" a table but more of a query.

It should look something like this:

SELECT et.*
FROM OPENROWSET( BULK 'your_data_file', FORMATFILE = 'your_format_file.fmt') AS et

Instead of giving the format in the table definition (as in oracle), you should add a `fmt` file. Here is how to create it

Problem

Is there an equivalent to Oracle's External Table in SQL Server ? An external table is a table which is mapped to a flat-file in the filesystem. It is very convenient since it allows you to read a flat-file as a table with standard SQL.

Original source