Reading Text file Using OpenRowset problem?

  • Hi..I am trying to read text file using OpenRowSet function for this my DBA was created linked Server with Name "DBLServerText", my text file path c:/txtcount.txt.

    Please guide me syntax any one have idea.

    Thanks in Advance..

    Mure

     

     

  • OpenRowSource and OpenRowSet in SQL Server 2000

    http://www.databasejournal.com/features/mssql/article.php/10894_3331881_3

    http://msdn2.microsoft.com/en-us/library/ms190312.aspx

     

    MohammedU
    Microsoft SQL Server MVP

  • Hi Sir,

    As per your mail I used the following Syntax my text file Name : "txtrecon.txt" and the file is in "C:\External", But it is showing the Error.

    select * from OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt)};

    DefaultDir=C:\External;','select * from txtrecon.txt')

    Server: Msg 7415, Level 16, State 1, Line 1

    Ad hoc access to OLE DB provider 'MSDASQL' has been denied. You must access this provider through a linked server.

    --

    I Created Linked Server Name "txtsrv"

    EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',

       'Microsoft.Jet.OLEDB.4.0',

       'c:\data\distqry',

       NULL,

       'Text'

    GO

    Please guide me how to read the text file

    Thanks for your kind help

    Mure

     

     

     

  • Enable "Enable OPENROWSET and OPENDATASOURCE support" option in Surface Area Configuration Manager and try again.., I believe it is disabled by default.

     

    MohammedU
    Microsoft SQL Server MVP

  • Sir,

    I didn't find out the option. Please guide me how to do this.

    Thanks

     

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply