Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Replace SQL Table with Excel data

I have a SQL database with a table that I need to periodically replace with
data from an Excel spreadsheet.

I wrote a proceedure using ADO to delete each record one by one - then
adding each record one by one, but it takes forever.

Is there a better way to do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Replace SQL Table with Excel data

The delete is easy. Actually I'd probably do it all from the server using
DTS Some ideas here. http://www.sqldts.com/

Dim strCnn As String
strCnn = "Provider=SQLOLEDB.1;" _
& "Integrated Security=SSPI;" _
& "Persist Security Info=False;" _
& "Initial Catalog=East_Intermediate;Data Source=pe1600"
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open strCnn
cnn.Execute "DELETE FROM Table_1"
cnn.Close

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Ken Valenti" wrote:
|I have a SQL database with a table that I need to periodically replace with
| data from an Excel spreadsheet.
|
| I wrote a proceedure using ADO to delete each record one by one - then
| adding each record one by one, but it takes forever.
|
| Is there a better way to do this?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007: How do I replace the default color table? Bifrost Excel Discussion (Misc queries) 0 May 6th 09 06:00 PM
Pivot Table with Data replace error Vinod[_2_] Excel Discussion (Misc queries) 1 January 25th 08 06:22 PM
Pivot table with data replace error. Vinod[_2_] Excel Discussion (Misc queries) 0 January 24th 08 02:01 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Replace all Pivot table data fields using VBA Silvershed Stu Excel Programming 0 April 4th 06 05:17 PM


All times are GMT +1. The time now is 02:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"