In many application we need Text file as datasource or as table
many ways to do this one of that as follows
create one folder on c drive name textfiles
and execute following code
EXEC sp_addlinkedserver txtdatasrc, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0', 'c:\textfiles', NULL, 'Text'
now your link server with name " txtdatasrc" is created
execute following code
EXEC sp_tables_ex txtdatasrc
see there is no record because folder does not contain any text file .
add new text file name table1 to folder
and again run command
EXEC sp_tables_ex txtdatasrc
see there is table name "table1#txt" in out put
now you can select rows from table1#txt by using select statment as follows
select * from txtsrv...table1#txt
this link server is very useful to access text as datasource
there are many othere methods and tricks in this stuff we will discuss soon...
Saturday, June 28, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment