sql 读取txt 文件内容,并写入sql的方法
sql 读取txt 文件内容,并写入sql的方法
SELECT * FROM OPENROWSET(BULK N'C:PALTEST.txt', SINGLE_BLOB) AS mytable
SELECT * FROM OPENROWSET(BULK N'C:PALTEST.txt', SINGLE_BLOB) AS mytable
--读取(导入) Excel 文件
USE master
SELECT * FROM OpenDataSource(
''Microsoft.Jet.OLEDB.4.0'',''Data Source="d:\Test.xls";User ID=Admin;Password=;Extended properties=Excel 5.0'')
...[Sheet1$]
5.
--读取(导入) Txt 文件
Select * From OpenRowSet (''MICROSOFT.JET.OLEDB.4.0'',''Text;HDR=NO;DATABASE=D:\'',test#txt)
BULK INSERT TSDB.dbo.ShipDemand
FROM 'E:\project\DropShipment\Demand\2008090211380938.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
)