> > Good day!!!
> > I planning to migrate my data from dbc to Sql Server
> >
> > My code to connect to Sql Server
> >
> > LOCAL lcCONN AS STRING
> > lcConn = "driver={sql server};server=(local);database=episys2;" ;
> > + "Trusted_Connection=yes;"
> >
> > IF lnConn < 0
> > LOCAL ARRAY laError(1)
> > AERROR(laError)
> > MESSAGEBOX("Connection Failed")
> > ELSE
> > MESSAGEBOX("Connection Established")
> > endif
> >
> >
> > I Have a database Contract.dbf on my dbc table as well as on SQL Server, How can I Update or insert all data to SQL Server.
> > Thanks
>
> 1. You can make your program to scan your local table and insert the data into your SQL Server using SPT.
>
> 2. You can create remote view that has structure exactly the same with your local table and then append the data directly using APPEND command.
>
> 3. You can use your Enterprise Manager in Server side and use Import/Export data if you have VFP ODBC installed in your server.
>
> there's still plenty options, but i think that's enough for now :)
>
> FoxHound
> ---------------------------------------------------------
> It’s not what you had achieved yesterday, nor what you are going to achieve tomorrow. But what you are achieving today define your success.
I tried this command to update the records of SQL Server it works but it's per field basis
SELECT 1
USE d:\master\Contract
nContract = ' '
SELECT 1
SCAN
nContract = Contract
@5,5 say nContract
SQLEXEC(lnConn, "INSERT INTO Contract (contract);
VALUES (&nContract)")
SELECT 1
endscan
I want to insert all records of contract.dbf to Sql Server Contract Table since the fields are the same only in one command of insert so i tried this command :
SELECT * FROM d:\master\contract WHERE contract = '0000074316' INTO
Array nContract
SQLEXEC(lnConn, "DELETE FROM Contract WHERE Contract <> ' ' ")
SQLEXEC(lnConn, "INSERT INTO CONTRACT FROM Array nContract")
It doesn't work at all , what would would I do
Thanks