Wrox Programmer Forums
|
SQL Server 2008 General discussion of SQL Server *2008* version only - not related to a specific book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2015, 01:27 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default DTS Package Equivalent

I've been using SQL Server 2000 for some time now, using a DTS package to import larges amounts of data on a monthly basis...

Believe it or not, the only thing that kept me from upgrading to 2008 was that some time ago, I tested the ability to import large amounts of data into SQL Server 2008, and it was very slow using the "Import and Export" wizard in 2008.

I use Access MDB as container files for the data tables.

What is the preferred method to import large data tables into SQL Server 2008?
 
Old April 7th, 2015, 09:12 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

if its 2008r2 research tableDiff. Its amazing. The source and destination tables must be identical in structure. I use a .bat file running on a windows Scheduled task to sync databases from one server/DB to another every night. Here is the .bat file. Only very small changes on lines 13-28 are required to use it, they should be very obvious.

Note - No changes are required to the :processTable function at the bottom

Code:
@ECHO OFF
color c0
echo.********************************************************************************
echo. Starting %CD% %date% %time%
echo ********************************************************************************
echo. 

echo ***********************************************************
echo * Set up tablediff and logs paths
echo ***********************************************************
echo.

SET folderDiffs=D:\Inetpub\Scripts\temp\folderToSavwSQLFiles
SET LogFolder=D:\Inetpub\Scripts\Logs\folderNameForLog
SET exeTableDiff="C:\Program Files\Microsoft SQL Server\100\COM\Tablediff.exe"
SET exeSqlCmd="C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe"

SET sourceServer=ServerName
SET sourceDatabase=DBName
SET sourceUser=UName
SET sourcePassword=pWord

SET destinationServer=ServerName
SET destinationDatabase=DBName
SET destinationUser=UName
SET destinationPassword=pWord

SET tables=tableOne, tableTwo, tableThree

for %%i in (%tables%) do (call :processTable %%i)
 

echo.********************************************************************************
echo. Finished %date% %time%
echo ********************************************************************************
echo. 

goto :end

:processTable
	SET sourceTable=%1
	SET destinationTable=%sourceTable%
	echo.********************************************************************************
	echo. Starting %date% %time%
	echo.
	echo. Processing %sourceTable%
	echo.********************************************************************************
	del /f /q %folderDiffs%\diffs_%sourceTable%.sql
	%exeTableDiff% -sourceserver %sourceServer% -sourcedatabase %sourceDatabase% -sourcetable %sourceTable% -sourceuser %sourceUser% -sourcepassword %sourcePassword% -destinationserver %destinationServer% -destinationdatabase %destinationDatabase% -destinationtable %destinationTable% -destinationuser %destinationUser% -destinationpassword %destinationPassword% -f %folderDiffs%\diffs_%sourceTable%.sql > %LogFolder%\diffs_%sourceTable%.log
	If Exist %folderDiffs%\diffs_%sourceTable%.sql %exeSqlCmd% -S %destinationServer% -d %destinationDatabase% -U %destinationUser% -P %destinationPassword% -i %folderDiffs%\diffs_%sourceTable%.sql

:end
__________________
Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with DTS PACKAGE mxwebb SQL Server DTS 1 November 28th, 2007 05:16 PM
DTS PACKAGE QUESTIONS girl SQL Server DTS 0 June 6th, 2007 02:58 AM
question on DTS package kpshende SQL Server 2000 0 April 22nd, 2006 07:08 AM
DTS Package failing ros1188 SQL Server DTS 1 August 17th, 2005 08:27 AM
Scheduling DTS Package chiefg SQL Server DTS 11 April 30th, 2004 11:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.