August 30, 2010 at 3:08 pm
I'm getting an error pointing to the last ')'; however, that may not be the real problem. Anyone know what is wrong?
I tried it with and without the ';User Id=;Password='. It doesn't work either way.
Insert into dirmsarf(dircode, msa, poppct, hhldpct, emppct, buspct, whtpct, blkpct, homecode, msacode2)
select dirmsarf2.dircode, dirmsarf2.msa, dirmsarf2.poppct,
dirmsarf2.hhldpct, dirmsarf2.emppct, dirmsarf2.buspct, dirmsarf2.whtpct,
dirmsarf2.blkpct, dirmsarf2.homecode, dirmsarf2.msacode2 from
OPENDATASOURCE( 'MSDASQL', 'Driver=Microsoft FoxPro VFP Driver;SourceType=DBF;SourceDb=C:\yeldata\dirmsarf.dbf;User Id=;Password=' )
August 30, 2010 at 3:21 pm
jesuslives01 (8/30/2010)
I'm getting an error pointing to the last ')'; however, that may not be the real problem. Anyone know what is wrong?I tried it with and without the ';User Id=;Password='. It doesn't work either way.
Insert into dirmsarf(dircode, msa, poppct, hhldpct, emppct, buspct, whtpct, blkpct, homecode, msacode2)
select dirmsarf2.dircode, dirmsarf2.msa, dirmsarf2.poppct,
dirmsarf2.hhldpct, dirmsarf2.emppct, dirmsarf2.buspct, dirmsarf2.whtpct,
dirmsarf2.blkpct, dirmsarf2.homecode, dirmsarf2.msacode2 from
OPENDATASOURCE( 'MSDASQL', 'Driver=Microsoft FoxPro VFP Driver;SourceType=DBF;SourceDb=C:\yeldata\dirmsarf.dbf;User Id=;Password=' )
Try:
Insert into dirmsarf(dircode, msa, poppct, hhldpct, emppct, buspct, whtpct, blkpct, homecode, msacode2)
select dirmsarf2.dircode, dirmsarf2.msa, dirmsarf2.poppct,
dirmsarf2.hhldpct, dirmsarf2.emppct, dirmsarf2.buspct, dirmsarf2.whtpct,
dirmsarf2.blkpct, dirmsarf2.homecode, dirmsarf2.msacode2 from
OPENDATASOURCE( 'MSDASQL', 'Driver=Microsoft FoxPro VFP Driver;SourceType=DBF;SourceDb=C:\yeldata\dirmsarf.dbf;User Id=;Password=' ) dirmsarf2
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
August 31, 2010 at 3:59 am
I tried your code and it gave an error on the 'dirmsarf2' at the end. I took it off and it gave an error on the last closing ')'
August 31, 2010 at 5:57 am
BOL examples show that after the connection info, you need the table to extrac t from, outside fo the parenthesis, and it appears to need 4 part naming conventions;
here'sa BOL example,
SELECT *
FROM OPENDATASOURCE('SQLNCLI',
'Data Source=London\Payroll;Integrated Security=SSPI')
.AdventureWorks2008R2.HumanResources.Employee
and heres something that passes the syntax check:
Insert into dirmsarf(dircode, msa, poppct, hhldpct, emppct, buspct, whtpct, blkpct, homecode, msacode2)
select
dirmsarf2.dircode,
dirmsarf2.msa,
dirmsarf2.poppct,
dirmsarf2.hhldpct,
dirmsarf2.emppct,
dirmsarf2.buspct,
dirmsarf2.whtpct,
dirmsarf2.blkpct,
dirmsarf2.homecode,
dirmsarf2.msacode2
from OPENDATASOURCE( 'MSDASQL',
'Driver=Microsoft FoxPro VFP Driver;SourceType=DBF;SourceDb=C:\yeldata\dirmsarf.dbf;User Id=;Password=;')
...dirmsarf2
Lowell
August 31, 2010 at 12:44 pm
Thanks but that gives me an error pointing to the last dirmsarf2:
Incorrect syntax near 'dirmsarf2'.
August 31, 2010 at 1:01 pm
jesuslives01 (8/31/2010)
Thanks but that gives me an error pointing to the last dirmsarf2:Incorrect syntax near 'dirmsarf2'.
well, what is the name of the table inside the foxpro database? is it dirmsarf, dirmsarf2 or something else? you aliased it in teh code as dirmsarf2.
Lowell
September 1, 2010 at 10:36 am
Thanks for all your effort. I found the problem. If I convert the decimal columns in the VFP table to type double, the above code works.
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy