adminbd

Записи по mssql,oracle,windows и linux

Have a Question?

If you have any question you can ask below or enter what you are looking for!

MSsql чтение excel и txt

чтение excel

SELECT * INTO XLImportBetaX FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test\xltest.xls', 'SELECT jobid,userid,start,stop,date FROM [14.09.2012$]')

insert INTO XLImport512 select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test\xltest.xls', 'SELECT * FROM [13.09.2012$]')

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test\xltest.xls', 'SELECT jobid,userid,start,stop,date FROM [14.09.2012$]')

select * from XLImportBeta2 exec sp_configure 'Ad Hoc Distributed Queries', 1 RECONFIGURE

чтение txt

 SELECT * FROM OPENROWSET(BULK N'C:\aos1.txt',SINGLE_CLOB ) AS Document

SELECT a.* FROM OPENROWSET( BULK 'c:\aos1.txt',
 FORMATFILE = 'c:\values.fmt') AS a;
 
   file format
 
 9.0
2
1  SQLCHAR  0  20 ":" 1 ID ""
2  SQLCHAR  0  20 "*" 2 IwD ""

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>