等效于SQL Server中的Oracle外部表 [英] Equivalent to Oracle external tables in SQL Server
问题描述
是否有等效于 Oracle的外部表在SQL Server中?
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.
这非常方便,因为它允许您使用标准SQL将平面文件读取为表.
It is very convenient since it allows you to read a flat-file as a table with standard SQL.
推荐答案
Harold Javier的答案是一个很好的答案,
但您可能还想考虑将 OPENROWSET 与BULK
一起使用关键词.
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.
它应该看起来像这样:
SELECT et.*
FROM OPENROWSET( BULK 'your_data_file', FORMATFILE = 'your_format_file.fmt') AS et
您应该添加一个fmt
文件,而不是在表定义中给出格式(如在oracle中).
此处是如何创建
Instead of giving the format in the table definition (as in oracle), you should add a fmt
file.
Here is how to create it
这篇关于等效于SQL Server中的Oracle外部表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!