Re: Stored Procedure to Connect a DBF File

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: John Bell (jbellnewsposts_at_hotmail.com)
Date: 10/25/04


Date: Mon, 25 Oct 2004 12:21:07 +0100

Hi

http://www.connectionstrings.com/ shows the connection string for a
Foxpro/DBF file, you just need to plug that into the information given in
the sp_addlinkedserver documentation in books online. Once you have created
the linked server you can use four part naming syntax to reference it as
part of the select_statement in a declare cursor statement (also documented
with examples in books online).

You can only pass the file location if you use dynamic SQL, but then
OPENROWSET would probably be a better option. You may then also have
problems with scope and be forced to make all the code dynamic.

John

"Prabhat" <not_a_mail@hotmail.com> wrote in message
news:uJaoq9nuEHA.1616@TK2MSFTNGP10.phx.gbl...
> Hi John,
>
> Thanks for reply. Can U give me an example of Linked Server and Opening
the
> records from a DBF file and after the Records (dbf) one by on using loop -
> So that for each record I can check the DB (SQL) for some Comparisions?
>
> And Can't I Pass the Path as Dynamic to the Function / T-SQL Block /
Stored
> procedure and then I will use the Linked Server?
>
> Thanks
> Prabhat
>
>
> "John Bell" <jbellnewsposts@hotmail.com> wrote in message
> news:O#g$FRnuEHA.1712@TK2MSFTNGP14.phx.gbl...
> > Hi
> >
> > If the file/location is going to be constant then a linked server may be
> the
> > better option, alternatively DTS may be an alternative rather than
trying
> to
> > battle with sp_OA*.
> >
> >
> > John
> >
> > "Prabhat" <not_a_mail@hotmail.com> wrote in message
> > news:Of7QeHnuEHA.2608@TK2MSFTNGP11.phx.gbl...
> > > Hi John,
> > >
> > > Thanks for reply.
> > >
> > > I just wanted to read the records with in the DBF file from Stored
> > > procedure - To perform some Action in SQL Server Table.
> > >
> > > I Don't know which is the Best Way : 1) Using Linked Server - As per
AI
> > > (or ) 2) Using ADO Connection etc.?
> > >
> > > Thanks
> > > Prabhat
> > >
> > >
> > > "John Bell" <jbellnewsposts@hotmail.com> wrote in message
> > > news:#A5OjHPuEHA.1008@tk2msftngp13.phx.gbl...
> > > > Hi
> > > >
> > > > I am not sure why you would want to do this, but you should be able
to
> > use
> > > > sp_OA... procedures as documented in Books Online. The examples in
> Books
> > > > Online are mainly SQLDMO but you should be ok with ADODB such as in
> > > > http://tinyurl.com/6pb35
> > > >
> > > > John
> > > >
> > > > "Prabhat" <not_a_mail@hotmail.com> wrote in message
> > > > news:eG6O4sNuEHA.1292@TK2MSFTNGP10.phx.gbl...
> > > > > Hi,
> > > > >
> > > > > Can I Open a ADO Recordset or ADO Connection from within the
Stored
> > > > > Procedure Like in VB Script?
> > > > >
> > > > > Thanks
> > > > > Prabhat
> > > > >
> > > > >
> > > > > "Al" <Al@discussions.microsoft.com> wrote in message
> > > > > news:AA49E2D7-0CBF-4055-9E31-F2C606EC3812@microsoft.com...
> > > > > > Hi,
> > > > > >
> > > > > > i've never tried it, but you might be able to create a Linked
> Server
> > > to
> > > > > the
> > > > > > file, after setting up an ODBC connection to it. The stored
> > procedure
> > > > will
> > > > > > then be to query the Linked Server.
> > > > > >
> > > > > > There are also the OPENROWSET and OPENDATASOURCE Transact-SQL
> > > commands,
> > > > > > which give you access to OLE DB datasources.
> > > > > >
> > > > > > DTS gives you access to dBase, and might be suitable for what
you
> > want
> > > > to
> > > > > > achieve.
> > > > > >
> > > > > > "Prabhat" wrote:
> > > > > >
> > > > > > > Hi All,
> > > > > > >
> > > > > > > Can I Connect to a DBF File and read the Records / Loop
through
> > the
> > > > > records
> > > > > > > of DBF file using / with in the Stored Procedure?
> > > > > > >
> > > > > > > Like in VB we Open as ADO Connection to Connect and a
Recordset
> To
> > > > Open
> > > > > etc.
> > > > > > >
> > > > > > > Thanks
> > > > > > > Prabhat
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Stored Procedure to Connect a DBF File
    ... Foxpro/DBF file, you just need to plug that into the information given in ... the sp_addlinkedserver documentation in books online. ... Can U give me an example of Linked Server and Opening ...
    (microsoft.public.sqlserver.server)
  • Re: Stored Procedure to Connect a DBF File
    ... Prabhat ... > Foxpro/DBF file, you just need to plug that into the information given in ... > the sp_addlinkedserver documentation in books online. ... Can U give me an example of Linked Server and Opening ...
    (microsoft.public.sqlserver.server)
  • Re: Stored Procedure to Connect a DBF File
    ... Prabhat ... > Foxpro/DBF file, you just need to plug that into the information given in ... > the sp_addlinkedserver documentation in books online. ... Can U give me an example of Linked Server and Opening ...
    (microsoft.public.sqlserver.programming)
  • Re: "Instead of" triggers and table constraints
    ... > I spoke with PSS on this issue and it turns out this case was omitted from ... They are going to update the documentation. ... Is there any alternate documentation of MS SQL Server 2000 as comprehensive ... as Books Online? ...
    (microsoft.public.sqlserver.datamining)
  • Re: Stored Procedure to Connect a DBF File
    ... procedures as documented in Books Online. ... > Can I Open a ADO Recordset or ADO Connection from within the Stored ... but you might be able to create a Linked Server to ... The stored procedure ...
    (microsoft.public.sqlserver.server)