Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 MS/Sql Strored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-28 : 08:19:31
Anthony Ozogu writes "How do you code a stored procedure to pull a data from a table from a MS Access database format in a different dirctory, wipe out the table contents in the SQL server and then populate it with the data pulled from the MS Access database? Thank you."

chadmat
The Chadinator

1974 Posts

Posted - 2002-02-28 : 11:41:15
create proc test

BEGIN
truncate table northwind..employees

insert into northwind..employees
select * from openrowset('Microsoft.Jet.OLEDB.4.0',
'c:\MSOffice\Access\Samples\northwind.mdb';'admin';'mypwd', Employees)

END


Didn't test this, but it should work.

-Chad




Edited by - chadmat on 02/28/2002 11:42:12
Go to Top of Page

efelito
Constraint Violating Yak Guru

478 Posts

Posted - 2002-02-28 : 11:43:14
This is fairly simple to do with a DTS package. Create a data source for the Access Database and one for the SQL Server. Create a SQL task to truncate the SQL table and add a transformation to copy the data from Access to SQL Server. Schedule the package and enjoy.

Jeff Banschbach
Consultant, MCDBA


.... Doh. Missed that part about wanting an SP and got beat to the post! I need another Pepsi.

Edited by - efelito on 02/28/2002 11:44:37
Go to Top of Page

aozogu
Starting Member

4 Posts

Posted - 2002-03-05 : 17:13:26
Server: Msg 7399, Level 16, State 1, Procedure TEST, Line 6
OLE DB provider 'MICROSOFT.JET.OLEDB.4.0' reported an error.
[OLE/DB provider returned message: Could not find installable ISAM.]


I get this error message when I run the code below

USE S8FREG
GO
CREATE PROCEDURE dbo.TEST
AS

TRUNCATE TABLE S8FREG..S8Registrants

INSERT INTO S8FREG..S8Registrants
SELECT * FROM OPENROWSET('MICROSOFT.JET.OLEDB.4.0','C:\ACCESS\S8FREG.MDB',S8Registrants)

GO

Go to Top of Page
   

- Advertisement -