Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Reading a text file from a stored procedure.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-24 : 07:32:27
Prasad writes "Please let me know the procedure of reading a text file from a stored procedure. Do I need to use any extended stored procedures ? I do not want the text file contents to be stored in any tables.

Thanks in advance,
Prasad P"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-25 : 09:39:33
You can use OpenRowSet or use Linked server

The following will add text files as Liked Server


EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'C:\testing',
NULL,
'Text'
GO

Note that C:\testing is the parent folder where your text file is located

Then write this query

select * from txtsrv...[test#txt] -- Replace test by the name of the text file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -