import from txt files

JonyBravo

Registered User.
Local time
Today, 03:43
Joined
Jan 17, 2006
Messages
89
Hi there

I'm new on SQL server and I need some help. I'm building a VB6 front end with SQL 2000 as a back end. I've built my tables but the information that will be feeding them It will be received weekly on text files and then I have to export manually into the tables. I woul like to know if is possible to create a batch file to do it for me.

I hope you understand what I need and thanks in advance
 
Hi there,

Right click on you database in enterprise manager, select all tasks then select import data. This will take you through a wizard that creates a DTS package at the end of the wizard it will give you options to save the package and schedule that package. Once you shedule a DTS package it will be put in a job.

Have a play ropund with it its easy
 
Thanks SQL_Hell. You are absolutely right. I would like to create a button on an VB6 application when clicked execute the saved packdge. Is this possible?

Thanks again
 
Hi again,

Yes this is possible, when you use the import wizard as I mentioned before it gives you options at the end to save and schedule the DTS package. if you schedule the DTS package then it will create a job that executes the DTS package.

This job can be viewed in enterprise manager under management/sqlserveragent/jobs

This job can executed from a VB command button by envoking a system store procedure called sp_start_job

So if your job is called bob then the command would be

exec sp_start_job 'bob'


If you dont know how to call a stored procedure from VB then look here

http://www.nigelrivett.net/VB/VBExecSPSimple.html
 
Hi there

Once again thanks SQL_Hell for your help.
I've use an example I've found to build the following dts.execution from VB:

Dim opackage As DTS.Package

Set opackage = New DTS.Package
opackage.LoadFromSQLServer PARS, , , DTSSQLStgFlag_UseTrustedConnection, , , , copyTxt, 0
opackage.Execute
opackage.UnInitialize
Set opackage = Nothing

The problem is when I execute it gives an error saying:
The specified DTS Package ('name='[notspecified]'; ID.Version ={'[notspecified]'},{'[notspecified]'}') does not exist.

Can anyone see what is wrong please?
Thanks again
 

Users who are viewing this thread

Back
Top Bottom