Re: "Linked Table" from a .txt file in SQL Server?



Almost there....

The only other thing is that I'm trying to use a text file that exports from
SAP, which wants to export to the 'C:\Documents and
Settings\USERNAME\SapWorkDir' directory. When specifying a datasource, is
there a way to use a variable to put in the currently logged on user in place
of USERNAME?

Thanks!

"Sue Hoegemeier" wrote:

> Something similar would be to create a linked server to
> access the text file. You use the Jet provider and set the
> data source to the directory which has the text files you
> want to access.
> EXEC sp_addlinkedserver @server ='TextLinkServer',
> @srvproduct='',
> @provider ='Microsoft.Jet.OLEDB.4.0',
> @datasrc='D:\',
> @provstr='Text'
>
> You could then get a list of all text files in the directory
> if you execute:
> EXEC sp_tables_ex 'TextLinkServer'
>
> You can access the files as listed in the directory. Use the
> table_name listed when you execute sp_tables_ex which is the
> text file name.
> select *
> from TextLinkServer...[YourFile#txt]
> to access D:\YourFile.txt
>
> -Sue
>
> On Wed, 6 Apr 2005 16:05:04 -0700, "Joel"
> <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >OKay, I'm really, really good with MS Access, but am just getting up to speed
> >on SQL Server. Is there a SQL Server equivalent of linking (not importing) a
> >table from a .txt file?
> >
> >Thanks!
>
>
.



Relevant Pages

  • Re: Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked
    ... I would still try to import the data into your SQL Server instance instead of running linked server queries as you are doing. ... I can query it with no problem and view tabs in Studio. ... EXEC master.dbo.sp_addlinkedserver ...
    (microsoft.public.sqlserver.programming)
  • Re: No more indexing on text
    ... Looking for a SQL Server replication book? ... DROP FULLTEXT CATALOG CmpArchivorCat ... exec sp_fulltext_catalog 'CmpArchivorCat', 'create' ... both text/plain and text/html in my file type column. ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Running a DTS Job from a stored procedure
    ... We are running SQL Server 2000. ... -- Create a Pkg Object ... EXEC sp_DisplayOAErrorInfo @oPKG, @hr ...
    (microsoft.public.sqlserver.dts)
  • Re: Error 21776: After creating new login
    ... EXEC DATA0003.dbo.sp_addlogin 'test','pwd' ... > another SQL Server session is not visible to the SQL-DMO session. ... > Jasper Smith ... >> Users collection. ...
    (microsoft.public.sqlserver.security)
  • Re: Auto truncate a string to be inserted to SQL table
    ... EXEC p --Warning was not returned ... Tibor Karaszi, SQL Server MVP ... >> Tibor Karaszi, SQL Server MVP ... >>> message is given...i might need to just truncate the string without halting>>> the process... ...
    (microsoft.public.sqlserver.programming)

Loading