Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use BULK INSERT ?
Message
From
03/11/2004 04:03:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
00956757
Message ID:
00957490
Views:
25
Mariam,
Why are you using MSDASQL. It's a wrapper driver for ODBC. Directly use VFPOLEDB driver (BTW MSDASQL works too). ie:
*Assuming SQL server has a table named myTable with same structure as ordItems
* lnHandle is ready
text to m.lcSQL textmerge noshow
insert into myTable ;
  SELECT * FROM 
  OPENROWSET('VFPOLEDB', 
  '<<_samples+"data\testdata.dbc">>';'';'',
  'select * from orditems')
endtext
SQLExec(m.lnHandle,m.lcSQL)
Cetin

>Thank you for help.
>i try to use OpenRowSet() but have a error message
>
>1)
>exec sp_addlinkedserver @server=N'CSTSERVER',
>@srvproduct ='',
>@provider = N'MSDASQL',
>@datasrc=N'DBF'
>2)
>exec sp_addlinkedsrvlogin @rmtsrvname=N'CSTSERVER',
>@useself = N'FALSE',
>@locallogin = NULL,
>@rmtuser = N'',
>@rmtpassword =N''
>
>first two work fine
>
>3)
>select * from [CSTSERVER].[Q:\FPDEV\COMMON\sqlappinspect]..[helpdb]
>
>here i have an error
>OLE DB provider 'MSDASQL' reported an error.
>[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified]
>OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitialize::Initialize returned 0x80004005: ].
>
>
>
>>>Hello All !
>>>I have VFP 8.0/SQL Server SPT application.
>>>I'm wondering is there any way to use BULK INSERT command for loading DBF file into a SQL Server table ? All examples I've seen were about loading text files and not the DBF.
>>>TIA
>>>Mariam
>>
>>Mariam,
>>It's because dbf files do not need BULK INSERT command. See OpenRowSet() - or search here for samples.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform