Showing posts with label dts. Show all posts
Showing posts with label dts. Show all posts

Monday, March 26, 2012

Duplicate Record Problem

I am working on a web application that utilizes a sql server database. One of the tables is a large text file that is imported through a DTS package from a Unix server. For whatever reason, the Unix box dumps quite a few duplicate records in the nightly run and these are in turn pulled into the table. I need to get rid of these duplicates, but can't seem to get a workable solution. the query that is needed to get the records is:
SELECT tblAppointments.PatientID, tblPTDEMO2.MRNumber, tblAppointments.PatientFirstName, tblAppointments.PatientLastName,
tblAppointments.PatientDOB, tblAppointments.PatientSex, tblAppointments.NewPatient, tblAppointments.HomePhone,
tblAppointments.WorkPhone, tblAppointments.Insurance1, tblPTDEMO2.Ins1CertNmbr, tblAppointments.Insurance2,
tblPTDEMO2.Ins2CertNmbr, tblAppointments.Insurance3, tblPTDEMO2.Ins3CertNmbr, tblAppointments.ApptDate, tblAppointments.ApptTime
FROM tblAppointments CROSS JOIN
tblPTDEMO2
WHERE (tblAppointments.PatientID = tblPTDEMO2.MRNumber)
AND tblAppointments.Insurance1 = 'MED'
AND tblAppointments.ApptTypeID <> 'MTG'
AND tblAppointments.ApptTypeID <> 'PNV'
AND DateDiff("dd", ApptDate, GetDate()) = 0
Order By tblAppointments.ApptDate
My first thought was to try to get a Select DISTINCT to work, but couldn't figure out how to do this with the query. My next thought was to try to set up constraints on the table, but, since there are duplicates, the DTS package fails. I assume there is a way to set up the transformations in a way to get this to work, but I'm not enough of an expert with SQL Server to figure this out on my own. I guess the other way to do this is to write some small script or application to do this, but I suspect there must be an easier way for those who know what they are doing. Any help on this topic would be greatly appreciated. Thanks.In SQL Server duplicates are eliminated by using Unique constraint or Index on the index you can add IGNORE_DUP_KEY option and make it all inserts because that option will not affect update statements. And they are very slow but the UNION operator also eliminates duplicates by applying implict Distinct. Run a search for all of the above in SQl Server BOL(books online). Hope this helps.|||For an import approach, I'd suggest inserting the records into atemporary table first. Then select out the unique records and insertthem into your destination table.
For the above query, would something like this work?
SELECT DISTINCT
PatientID,
MRNumber,
PatientFirstName,
PatientLastName,
PatientDOB,
PatientSex,
NewPatient,
...etc, etc, etc...
FROM
(
SELECT tblAppointments.PatientID, tblPTDEMO2.MRNumber, tblAppointments.PatientFirstName, tblAppointments.PatientLastName,
tblAppointments.PatientDOB, tblAppointments.PatientSex, tblAppointments.NewPatient, tblAppointments.HomePhone,
tblAppointments.WorkPhone, tblAppointments.Insurance1, tblPTDEMO2.Ins1CertNmbr, tblAppointments.Insurance2,
tblPTDEMO2.Ins2CertNmbr,tblAppointments.Insurance3, tblPTDEMO2.Ins3CertNmbr,tblAppointments.ApptDate, tblAppointments.ApptTime
FROM tblAppointments CROSS JOIN
tblPTDEMO2
WHERE (tblAppointments.PatientID = tblPTDEMO2.MRNumber)
AND tblAppointments.Insurance1 = 'MED'
AND tblAppointments.ApptTypeID <> 'MTG'
AND tblAppointments.ApptTypeID <> 'PNV'
AND DateDiff("dd", ApptDate, GetDate()) = 0
Order By tblAppointments.ApptDate
) AS SQ|||

I have re-written this a bit to remove the CROSS JOIN syntax which I think is less efficient than the INNER JOIN that is implied in the WHERE clause:
SELECT A.PatientID, D.MRNumber, A.PatientFirstName, A.PatientLastName, A.PatientDOB, A.PatientSex,
A.NewPatient, A.HomePhone, A.WorkPhone, A.Insurance1, D.Ins1CertNmbr, A.Insurance2,
D.Ins2CertNmbr, A.Insurance3, D.Ins3CertNmbr, A.ApptDate, A.ApptTime
FROM tblAppointments A INNER JOIN tblPTDEMO2 D on A.PatientID = D.MRNumber
WHERE A.Insurance1 = 'MED'
AND A.ApptTypeID <> 'MTG'
AND A.ApptTypeID <> 'PNV'
AND DateDiff("dd", ApptDate, GetDate()) = 0
Order By A.ApptDate

Now, I assume that the duplicates are in thetblPTDEMO2table. Tell me more about these: are the IDs duped?

|||Thanks for your response. The query you wrote is conceptually what I am trying to get, but it throws a syntax error. I've played with a number of variations of this and I can't seem to get it to work.
The other option of using a temporary table during the DTS package is viable, but once again, I can't seem to get the query right. I think what I want is something like:
Insert Into tblAppointments AppointmentKey, PatientFirstName, PatientLastName, ...VALUES (Select DISTINCT AppointmentKey, PatientFirstName, PatientLastName, ...)
but once again, I can't seem to get the syntax correct. Any help would be greatly appreciated. Thanks.|||Thanks for your response. Actually, the tblAppointments table is the one with the duplicates, and yes, the IDs are duplicated as well.

Wednesday, March 7, 2012

DTSTransformationSTATus constants !

Hi
I am building a DTS package, to read a IIS Log files into SQL-Server database file through a DTS package.

It is runing smooth, but sometimes the Log file include some CR LF, unexpected text,...etc so the DTS package can't read the fields perfectly and it fails, and I recieve an error.

I am up to use ActiveX Script in VBScript language to have more control over the flow of the transformation of the data operation.

Now, how can I use the DTSTransformationSTATUS constants to make my loops and check the different source fields?

I will appreciate an examples that control the folow of the Transformation of a TEXT file.

Thank you for your help in advance.

KhalidHow big are the log files ? What are the patterns to these hiccups ? Have you thought about writing a small app(vb,perl) that corrects the file first then use dts to import the file - you could actually make this a part of your dts package (calling the app) ?|||The log files are 50 MB to 60 MB in size.

About writing an Application to correct the log file, this is exactuly what I am up to, and since DTS is providing a powerful tools through VBScript or VBJScript to have more control over the Transformation process, I have decided to use these tools.

There are some constants such as DTSTransformationSTATUS_Error, DTSTransformationSTATUS_ErrorInfo,.. etc . These constants can be used to control the flow of the Transformation process and to handle the errors if any.

I need an example using these constants to make things more clear for me to build my own application.

Do you have any idea about these constants?

Thanks

DTSRun.exe doesn't exit if i run from command prompt

Hi,
I have a DTS package. When I run it from a DOS prompt as following,
c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name
Eveything is fine. I can see something like log messages output from the
command.
Then if I redirect output into a file like and run it again,
c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name >output_file
then the command never come back from it running. I'm sure the dts package
itself has finished running by check the output_file. The output_file said
like that the package has completed.
Can any help me solve this issue, what is the problem?
-Senthil
Maybe
WWW.SQLDTS.COM
Saludos
IIslas
"Spsk" wrote:

> Hi,
> I have a DTS package. When I run it from a DOS prompt as following,
> c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name
> Eveything is fine. I can see something like log messages output from the
> command.
> Then if I redirect output into a file like and run it again,
> c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name >output_file
> then the command never come back from it running. I'm sure the dts package
> itself has finished running by check the output_file. The output_file said
> like that the package has completed.
> Can any help me solve this issue, what is the problem?
> -Senthil
|||Thanks, I couldn't find any related this issue the sqldts.com...
Could anyone help me..
-Spsk
"Isaias" wrote:
[vbcol=seagreen]
> Maybe
> WWW.SQLDTS.COM
> --
> Saludos
> IIslas
>
> "Spsk" wrote:

DTSRun.exe doesn't exit if i run from command prompt

Hi,
I have a DTS package. When I run it from a DOS prompt as following,
c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name
Eveything is fine. I can see something like log messages output from the
command.
Then if I redirect output into a file like and run it again,
c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name >output_file
then the command never come back from it running. I'm sure the dts package
itself has finished running by check the output_file. The output_file said
like that the package has completed.
Can any help me solve this issue, what is the problem?
-SenthilMaybe
WWW.SQLDTS.COM
--
Saludos
IIslas
"Spsk" wrote:

> Hi,
> I have a DTS package. When I run it from a DOS prompt as following,
> c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name
> Eveything is fine. I can see something like log messages output from the
> command.
> Then if I redirect output into a file like and run it again,
> c:>dtsrun /S sql_server /U userid /P pwd /N dts_package_name >output_file
> then the command never come back from it running. I'm sure the dts package
> itself has finished running by check the output_file. The output_file said
> like that the package has completed.
> Can any help me solve this issue, what is the problem?
> -Senthil|||Thanks, I couldn't find any related this issue the sqldts.com...
Could anyone help me..
-Spsk
"Isaias" wrote:
[vbcol=seagreen]
> Maybe
> WWW.SQLDTS.COM
> --
> Saludos
> IIslas
>
> "Spsk" wrote:
>

DTSrun.exe - application error

Please help!!
The above keep appearing when we schedule a dts to run.
We can run the dts manually as a local package and it
works, but when run through as a job, either as a schdule
or manually it fails.
Can anybody enlighten me as to why this is happening?
Di Nicholls,
Could you post the full error? You might get a better response in the
..dts newsgroup.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Di Nicholls wrote:
> Please help!!
> The above keep appearing when we schedule a dts to run.
> We can run the dts manually as a local package and it
> works, but when run through as a job, either as a schdule
> or manually it fails.
> Can anybody enlighten me as to why this is happening?

DTSrun.exe - application error

Please help!!
The above keep appearing when we schedule a dts to run.
We can run the dts manually as a local package and it
works, but when run through as a job, either as a schdule
or manually it fails.
Can anybody enlighten me as to why this is happening?Di Nicholls,
Could you post the full error? You might get a better response in the
.dts newsgroup.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Di Nicholls wrote:
> Please help!!
> The above keep appearing when we schedule a dts to run.
> We can run the dts manually as a local package and it
> works, but when run through as a job, either as a schdule
> or manually it fails.
> Can anybody enlighten me as to why this is happening?

dtsrun works from command prompt, but hangs from Query Analyzer

I have a dts that works from the command prompt, but hangs in Query Analyzer. Here's the code inside Query Analyzer:
exec master..xp_cmdshell 'dtsrun /S BFHSQL4 /N vhl_dts_14144b /E'

From the command prompt, it's just:
dtsrun /S BFHSQL4 /N vhl_dts_14144b /E

Any ideas what's wrong? Thanks for your help!Did the dtsrun cause SQL Server hang or just Query Analyzer hang? Did you got any error message when executing the package from Query Analyzer? You need more information for troubleshooting: use SQL Profiler to respectively capture a trace when execute dtsrun to the same package from commandline and Query Analyzer.|||Thanks for your response. I guess hangs might not be the right word. There are no error messages. Query Analyzer just tries to execute the package forever. It takes less than a minute to run from the command prompt. I've let it run for 1/2 hour in Query Analyzer before cancelling the query, then it takes several minutes to cancel. Other packages run fine with the same syntax. I think the problem is with this particular package. The dts just runs an activeX script, as follows:
Function Main()
Dim fileName

fileName = "\\mypath\myExcelFile.xls"

dim excelObject
set excelObject = CreateObject("Excel.Application")

excelObject.workbooks.open fileName

excelObject.Quit
set excelObject = Nothing

Main = DTSTaskExecResult_Success
End Function

I'm not really familiar with SQL Profiler. Do you still think using it will be helpful for this scenario? Thanks again for your help.|||Turns out that there was code inside the Excel file that was trying to save a file to a path that didn't exist. I fixed the path and now everything works fine.

DTSRun Utility Wont

I have been successful at setting up three or four DTS packages to run
using the DTSrun command line utility and the Windows scheduler until
now. The latest package gives me the following error no matter what I
try.

Error: -2147217355 (80041035); Provider Error: 0 (0)
Error string: General error -2147217355 (80041035).
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts80.hlp
Help context: 705

I googled the error but got only two hits, only one of which actually
discussed the error. That one talked about the security and ID context
of the system agent but I can't even run the package from the command
line, never mind using the Windows chron. The DTS command line I'm
using looks like this:

DTSRun /S MyServer\Instance /R DBName /N MyDTSPacakgeName /E

Variations included /U MyUserName /P MyPassWord and a couple others.
Next step would have been to use /!Y and /!C to create an encoded batch
file to use for the Windows scheduler.
Any help would be most appreciated.
RandyCan you run the DTS package from the designer (hopefully on the same
machine)? Just seeing if the error might be internal to the package.

Stu|||Runs like a champ from designer. Won't run scheduled from Enterprise
Manager, whether on a client machine or directly on the server and
won't run from a command line.|||And you can run other packages this same way? That would certainly
rule out any permissions problems, but I'm drawing a blank as to what's
going on.

Stu|||Exactly. I have one other package that runs every night but it's been
running for three or four months now. I have another package that I ran
one time last weekend using Windows scheduler again with no problem.
This third package needs to run every day from now on but I can't get
it to run from a command line which is the first step I take toward
building a batch file for scheduler.
And there are VERY few references to the error using Google, which
surprised me.

DTSrun utility security ?

Using SQL2000

I've created a DTS package and I now want to kick it off via a webpage interface. The package is realatively simple and either adds new rows to a table or updates them or both.

My question is this. If I create a batch file on the server that calls the DTS package and the Webpage is the client which executes the batch file what security context is the package going to run in.

The dtsrun batch file looks like this.
dtsrun /Sservername /Npackagename /E /Mpassword

The /E tells the package to use windows authentication.

As always, ThanksHi

A batch file will usually run in the security context of the user that kicked it off. Its worth making sure the user context has the required access to tables stored procedures etc ( read, update etc ) as well.

Be careful too if you are passing user crededtials from a web site on the internet to the SQL box - its an accident waiting to happen unless its an encrypted link ( people can "sniff" network traffic to capture the username & password). Alternatively, you could have a web page that updates a field in a table and have a job on the server that scans the table for a change in value, then kicks off a DTS package. This stops credentials being passed around the network.

Cheers,

SG.|||Great information and very unique way of getting around the username and password thing. I was expecting that I would have to encrypt but with your suggestion I'm thinking I'll try the table update you suggested.

I was fairly sure about the security context but I wanted to double check.

Thanks for the reply

Mike|||Howdy

Glad I could help.

Cheers

SG

DTSRUN utility

I would like to run a dts package from the command-line and I am trying to integrate a process exit code in my DTS package which I can intercept in my command-line. Is this possible. Because the next step in my batch file is dependent on the outcome of my DTS package.

Let me know if you have already tackeled that problem.I just did this test in SQL 7.0.

I created a simple package that just had 1 Activex Script Task:

Function Main()
Main = DTSTaskExecResult_Failure
End Function

From the command-line I ran DTSRUN utility, after which I checked the status of errorlevel, the DOS error status variable and it was set to 1, error. A value of 0 is success.

c:\ dtsrun /S nike /E /Ptest /M
c:\ echo %errorlevel%|||So simple and yet so effective. THX

Sunday, February 26, 2012

dtsrun to start a package - cannot find xp_cmdshell

Newbie here.

In my database I'm needing to automate some data imports. I have the
import set up as a DTS package and it works wonderfully. But I'm
having trouble kicking it off as a stored procedure, or even from the
Query Analyzer. I used dtsrunui to get a proper connection string, but
when I enter

EXEC xp_cmdshell 'dtsrun /S "(local)" /N "MyPackage" /A
"KeyNum":"19"="19687627" /W "0" /E'

I get an error that says "Could not find stored procedure
'xp_cmdshell'". xp_cmdshell is indeed there, under Master, Extended
Procedures. I tried calling it dbo.xp_cmdshell, but that didn't help.
I'm guessing that I need to point the command to the location of the
SP, but I have no idea how to do that. Anyone willing to shed a little
light would get my eternal gratitude. :)

Thanks in Advance, maddmanuse master first or add master. to the procedure name. xp's don't operate
like sp's where you can call them from any database.
kevin Ruggles

"Maddman" <maddman_75@.yahoo.com> wrote in message
news:1102626201.340243.92890@.f14g2000cwb.googlegro ups.com...
> Newbie here.
> In my database I'm needing to automate some data imports. I have the
> import set up as a DTS package and it works wonderfully. But I'm
> having trouble kicking it off as a stored procedure, or even from the
> Query Analyzer. I used dtsrunui to get a proper connection string, but
> when I enter
> EXEC xp_cmdshell 'dtsrun /S "(local)" /N "MyPackage" /A
> "KeyNum":"19"="19687627" /W "0" /E'
> I get an error that says "Could not find stored procedure
> 'xp_cmdshell'". xp_cmdshell is indeed there, under Master, Extended
> Procedures. I tried calling it dbo.xp_cmdshell, but that didn't help.
> I'm guessing that I need to point the command to the location of the
> SP, but I have no idea how to do that. Anyone willing to shed a little
> light would get my eternal gratitude. :)
> Thanks in Advance, maddman|||That did the trick. Thanks!

DTSRun remote execution

Hi,

I am trying to figure out a way for a machine other than the SQL Server 2000 machine hosting my DTS jobs to fire off a DTS job on request. The jobs are scheduled, but I want to be able to fire them off remotely if the schedule fails. I don't have access Enterprise Manager on the second machine I want to start the jobs from.

An added restriction I have is that I can only execute command line shell scripts on the second machine. This could be a batch file, an executable or any other function available from the command line.

In an initial attempt I made the SQL Server Binn directory available via a restricted network share so the second machine could access the DTSRun.exe file. I then created the DTSRun commands and set them up to run. This worked fine, except I ran into another complication. The DTS Jobs I am running make use of an ActiveX DLL and an ActiveX Control (OCX). These files are registered on the server, but since using DTSRun forces execution to take place on the machine issuing the DTSRun command, the jobs fail because the components are not installed on the second machine.

I would like to try and aviod installing these components on the second machine and was hoping someone could suggest an alternative method for remotely fireing off these DTSJobs.

Any help would be greatly appreciated!

Thanks!
- BradMy first suggestion would be to use a VBScript that uses ADO to manually force execution of the remote job that runs the DTS package.

Just about anything else (SP, CmdExec, etc) is going to run the DTS in the context of your client which may not be desirable for reasons other than the registered ActiveX controls you mention.

Another option might be to create a job or DTS package that checks the original and makes sure that it has run (and executes it if it has not). Or you could simply add this as an additional error check into the original DTS package (set a retry counter and a Global Variable with the maximum number of retries). You would need to examine the business requirements and design a strategy that suits your environment.

Regards,

Hugh Scott

Originally posted by BradC
Hi,

I am trying to figure out a way for a machine other than the SQL Server 2000 machine hosting my DTS jobs to fire off a DTS job on request. The jobs are scheduled, but I want to be able to fire them off remotely if the schedule fails. I don't have access Enterprise Manager on the second machine I want to start the jobs from.

An added restriction I have is that I can only execute command line shell scripts on the second machine. This could be a batch file, an executable or any other function available from the command line.

In an initial attempt I made the SQL Server Binn directory available via a restricted network share so the second machine could access the DTSRun.exe file. I then created the DTSRun commands and set them up to run. This worked fine, except I ran into another complication. The DTS Jobs I am running make use of an ActiveX DLL and an ActiveX Control (OCX). These files are registered on the server, but since using DTSRun forces execution to take place on the machine issuing the DTSRun command, the jobs fail because the components are not installed on the second machine.

I would like to try and aviod installing these components on the second machine and was hoping someone could suggest an alternative method for remotely fireing off these DTSJobs.

Any help would be greatly appreciated!

Thanks!
- Brad|||Hi Hugh, thanks for the reply.

The VBScript option sounds like it may be the way to go. Using a number of retries approach may not work in this case because we need to be able to manually fire off the jobs on request. Catch is, the people who will be firing off these jobs don't have access (or skills) to go into enterprise manager to run them.

If a VBScript file is used to fire off a job using ADO, would the job be executed on the server or on the local client machine? From your comments on context I gather it will be run on the server (which is a good thing in this case as it avoids the ActiveX components needing to be installed on client machines).

Thanks again for the help!

- Brad

[SIZE=1]Originally posted by hmscott
My first suggestion would be to use a VBScript that uses ADO to manually force execution of the remote job that runs the DTS package.|||Im using a stored procedure to run my DTS from the outside whenever I want.

CREATE PROCEDURE ProcImportFile AS
EXEC msdb.dbo.sp_start_job @.job_name = 'Import_file'
GO

I scheduled the DTS package to get a job to call from the procedure.

Haven't tried this solution fully yet beacuse there is some problems regarding the permissions on my database. If i execute the package manually it works fine. But the scheduled job fails averytime...
Helpdesk hasn't fixed it yet.

DTSRUN privileges?

I am trying to get a DTS package to be run from the command line with
the dtsrun utility. The DTS package is stored in the database. The user
I supply is a user in the database. I get an error stating "SQL Server
does not exist or access denied." It looks to me like the SQL Server
instance does exist because it tries to start the package. I get
"DTSRun: Executing". If I put in a server that is non-existent, I do not
get that message. I also know that my username and password are correct.

Here is output from my attempt to run dtsrun for my DTS pkg (server,
user, password change to protect my db security):

C:\>dtsrun /Sserver_name /Uuser /Ppass /Npkg_name
DTSRun: Loading...
DTSRun: Executing...
DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1
DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147467259 (80004005)
Error string: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server
does not exist or access denied.
Error source: Microsoft OLE DB Provider for SQL Server
Help file:
Help context: 0
Error Detail Records:
Error: -2147467259 (80004005); Provider Error: 17 (11)
Error string: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server
does not exist or access denied.
Error source: Microsoft OLE DB Provider for SQL Server
Help file:
Help context: 0
DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1
DTSRun: Package execution complete.

I suspect that my user I am connecting to the database with does not
have privileges to execute the DTS package. I cannot determine, from
BOL, what privs I need to grant to this user to let them execute this
package. Any ideas?

TIA,
Brian

--
================================================== =================

Brian Peasland
oracle_dba@.nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.

"I can give it to you cheap, quick, and good.
Now pick two out of the three" - UnknownHi Brian.

The fact that it says:
> DTSRun: Loading...
> DTSRun: Executing...

indicates your user can run DTSRUN. What is more likely is that user cannot
connect to the servers and databases named in the package.

Try going into Query analyzer and connect to the server as that user and see
if you can connect to the database and select from some of its tables.

--
-Dick Christoph

"Brian Peasland" <oracle_dba@.nospam.peasland.net> wrote in message
news:IyqxzH.BFw@.igsrsparc2.er.usgs.gov...
>I am trying to get a DTS package to be run from the command line with the
>dtsrun utility. The DTS package is stored in the database. The user I
>supply is a user in the database. I get an error stating "SQL Server does
>not exist or access denied." It looks to me like the SQL Server instance
>does exist because it tries to start the package. I get "DTSRun:
>Executing". If I put in a server that is non-existent, I do not get that
>message. I also know that my username and password are correct.
> Here is output from my attempt to run dtsrun for my DTS pkg (server, user,
> password change to protect my db security):
> C:\>dtsrun /Sserver_name /Uuser /Ppass /Npkg_name
> DTSRun: Loading...
> DTSRun: Executing...
> DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1
> DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147467259
> (80004005)
> Error string: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does
> not exist or access denied.
> Error source: Microsoft OLE DB Provider for SQL Server
> Help file:
> Help context: 0
> Error Detail Records:
> Error: -2147467259 (80004005); Provider Error: 17 (11)
> Error string: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does
> not exist or access denied.
> Error source: Microsoft OLE DB Provider for SQL Server
> Help file:
> Help context: 0
> DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1
> DTSRun: Package execution complete.
>
> I suspect that my user I am connecting to the database with does not have
> privileges to execute the DTS package. I cannot determine, from BOL, what
> privs I need to grant to this user to let them execute this package. Any
> ideas?
>
> TIA,
> Brian
>
>
> --
> ================================================== =================
> Brian Peasland
> oracle_dba@.nospam.peasland.net
> http://www.peasland.net
> Remove the "nospam." from the email address to email me.
>
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown|||To add to Dick's response, be aware that the DTS package runs on same
machine as DTSRUN. You'll get these errors if you run the package on a
client machine and have specified SQL Server name 'local' in the DTS
connection.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Brian Peasland" <oracle_dba@.nospam.peasland.net> wrote in message
news:IyqxzH.BFw@.igsrsparc2.er.usgs.gov...
>I am trying to get a DTS package to be run from the command line with the
>dtsrun utility. The DTS package is stored in the database. The user I
>supply is a user in the database. I get an error stating "SQL Server does
>not exist or access denied." It looks to me like the SQL Server instance
>does exist because it tries to start the package. I get "DTSRun:
>Executing". If I put in a server that is non-existent, I do not get that
>message. I also know that my username and password are correct.
> Here is output from my attempt to run dtsrun for my DTS pkg (server, user,
> password change to protect my db security):
> C:\>dtsrun /Sserver_name /Uuser /Ppass /Npkg_name
> DTSRun: Loading...
> DTSRun: Executing...
> DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1
> DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147467259
> (80004005)
> Error string: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does
> not exist or access denied.
> Error source: Microsoft OLE DB Provider for SQL Server
> Help file:
> Help context: 0
> Error Detail Records:
> Error: -2147467259 (80004005); Provider Error: 17 (11)
> Error string: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does
> not exist or access denied.
> Error source: Microsoft OLE DB Provider for SQL Server
> Help file:
> Help context: 0
> DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1
> DTSRun: Package execution complete.
>
> I suspect that my user I am connecting to the database with does not have
> privileges to execute the DTS package. I cannot determine, from BOL, what
> privs I need to grant to this user to let them execute this package. Any
> ideas?
>
> TIA,
> Brian
>
>
> --
> ================================================== =================
> Brian Peasland
> oracle_dba@.nospam.peasland.net
> http://www.peasland.net
> Remove the "nospam." from the email address to email me.
>
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown|||DickChristoph wrote:
> Hi Brian.
> The fact that it says:
>> DTSRun: Loading...
>> DTSRun: Executing...
> indicates your user can run DTSRUN. What is more likely is that user cannot
> connect to the servers and databases named in the package.
> Try going into Query analyzer and connect to the server as that user and see
> if you can connect to the database and select from some of its tables.

The user can connect to the database and query tables just fine with QA.
This is not a Windows user, but rather one that is authenticated in the
database.

Thanks,
Brian

--
================================================== =================

Brian Peasland
oracle_dba@.nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.

"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown|||Dan Guzman wrote:
> To add to Dick's response, be aware that the DTS package runs on same
> machine as DTSRUN. You'll get these errors if you run the package on a
> client machine and have specified SQL Server name 'local' in the DTS
> connection.

I do plan on running the DTSRUN utility from a client machine, but I
have stated the SQL Server's name in the /S switch. I did not use
'local' or '.' for the server name since I know the package is not local
to the client.

Thanks,
Brian

--
================================================== =================

Brian Peasland
oracle_dba@.nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.

"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown|||Hi Brian

Can you open the package and look at the connections. Dan was suggesting
that one of these connections might be "(local)". also I would add to my
previous comment, the username specified for these connections might lack
the privileges to connect to the database.

Also if to open the package and execute it from the designer you can see
which step is crashing.

--
-Dick Christoph
"Brian Peasland" <oracle_dba@.nospam.peasland.net> wrote in message
news:Iyrtp9.25D@.igsrsparc2.er.usgs.gov...
> Dan Guzman wrote:
>> To add to Dick's response, be aware that the DTS package runs on same
>> machine as DTSRUN. You'll get these errors if you run the package on a
>> client machine and have specified SQL Server name 'local' in the DTS
>> connection.
>>
> I do plan on running the DTSRUN utility from a client machine, but I have
> stated the SQL Server's name in the /S switch. I did not use 'local' or
> '.' for the server name since I know the package is not local to the
> client.
> Thanks,
> Brian
> --
> ================================================== =================
> Brian Peasland
> oracle_dba@.nospam.peasland.net
> http://www.peasland.net
> Remove the "nospam." from the email address to email me.
>
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown

DTSrun in Stored Procedure

Hi,

I'm writing a stored procedure to run a dts package and I've successfuly
got this working using my sotred proc and the syntax of dtsrun is
correct.

However, I'm trying to pass a variable to the DTSrun command and this is
where I'm having the problem

the code for the proc is:

Declare @.partcode nvarchar(255)

EXEC master..xp_cmdshell 'DTSRun /S "server" /U "user" /P "password" /N
"XMLStockCheck" /A "oPartCode":"8"="' + @.partcode + '" /W "0" '

Everytime I run it I get this error:

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '+'.

can someone help me with this please?

M3ckon

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You'll to build the command string before executing xp_cmdshell. For
example:

DECLARE @.Command varchar(1000)

SET @.Command = 'DTSRun /S "server" /U "user" /P "password" /N
"XMLStockCheck" /A "oPartCode":"8"="' + @.partcode + '" /W "0" '

EXEC master..xp_cmdshell @.Command

--
Hope this helps.

Dan Guzman
SQL Server MVP

"m3ckon" <anonymous@.devdex.com> wrote in message
news:407eb7e2$0$206$75868355@.news.frii.net...
> Hi,
> I'm writing a stored procedure to run a dts package and I've successfuly
> got this working using my sotred proc and the syntax of dtsrun is
> correct.
> However, I'm trying to pass a variable to the DTSrun command and this is
> where I'm having the problem
> the code for the proc is:
> Declare @.partcode nvarchar(255)
> EXEC master..xp_cmdshell 'DTSRun /S "server" /U "user" /P "password" /N
> "XMLStockCheck" /A "oPartCode":"8"="' + @.partcode + '" /W "0" '
> Everytime I run it I get this error:
> Server: Msg 170, Level 15, State 1, Line 3
> Line 3: Incorrect syntax near '+'.
> can someone help me with this please?
> M3ckon
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

dtsrun from stored procedure

Hi all,

I am currently using a series of dts packages to extract and export data. To run the packages, I have a table (TW_DTS) which lists each dts package name, I then use a stored procedure to loop through each and 'dtsrun' it. If a package fails then the error is stored in another table from within the individual dts.

This solution works in principle, however when the stored procedure runs some of the dts packages fail for an unknown reason. Unfortunately the problem is not consistent - it is not always the same package, or even same number of packages that fail. Each package will work when run individually.

I have listed the stored procedure below, any advice may save me from throwing my laptop through the window.

Cheers.

----

CREATE PROCEDURE [spTWDTS] AS

DECLARE @.unique_id varchar(50)
DECLARE @.dts_name varchar(50)
DECLARE @.start_dttm datetime
DECLARE @.end_dttm datetime
DECLARE @.CMD varchar(1000)
DECLARE @.ERROR varchar(1000)

DECLARE
dts_cur CURSOR FOR SELECT unique_id, dts_name, start_dttm, end_dttm from TW_DTS where status = 'A'

open dts_cur

FETCH dts_cur INTO @.unique_id, @.dts_name, @.start_dttm, @.end_dttm

while @.@.fetch_status = 0

BEGIN
-- Set as No Error
SET @.ERROR = 0

--update the start date
UPDATE TW_DTS set start_dttm = getdate() where unique_id = @.unique_id

--run the package
SET @.CMD = 'dtsrun /S myserver /U myusername /P mypassword/N '+@.dts_name
EXECUTE @.ERROR = master..xp_cmdshell @.CMD

--update the end date
UPDATE TW_DTS set end_dttm = getdate() where unique_id = @.unique_id

--move to next dts package
FETCH dts_cur INTO @.unique_id, @.dts_name, @.start_dttm, @.end_dttm

END

CLOSE dts_cur
DEALLOCATE dts_cur

RETURN @.ERROR
GONot sure about this but perhaps dtsrun /L might help in finding out where/when the execution fails. You might want to add a select 'executed: ' + @.dts_name, 'Error', @.error after the xp_cmdshell. I assume there's a space between the password and the /N ? And perhaps adding a 'start /w ' to the command might help.

Like I said, I'm not sure if their any help but it might get you on the right track.|||Thanks Kaiowas,

Tried that and got the following error message in the log file:

Step 'Copy Data from Results to [export].[dbo].[extract] Step' failed

Step Error Source: Microsoft OLE DB Provider for Oracle
Step Error Description:Oracle error occurred, but error message could not be retrieved from Oracle.
Step Error code: 80004005
Step Error Help File:
Step Error Help Context ID:

The step just runs an oracle query and put the results into the 'extract' table.

Not really any the wiser now, do you know how I can get to the oracle error?|||It's an MDAC error message, so Oracle won't help you there. I find google to be very helpful in such cases, it came up with: http://support.microsoft.com/kb/255084/EN-US/

DTSRun Fails while executing from COM

Hi,
i wrote a VB function that runs DTS by DTSRUN command, its working fine but when i copy the same code in COM and run it from ASP page and VB it fails to execute.

Function ExeDTSRun(DTSName, mKey As String)
Dim mDTS, spServerName, spUid, spPwd As String

spUid = "sa"
spPwd = "test"
spServerName = "server"


mDTS = "DTSRun /S " & spServerName & " /U " & spUid & " /P " & spPwd & " /N " & DTSName & " /G " & mKey & " /W ""0"""
Shell mDTS, vbNormalFocus
ExeDTSRun = "Successfully Run DTS : " & DTSName
End Function

Regards
AdiDo you get an error?|||First guess: Does the account running the IIS thread have permission (NT permission) to execute DTSRUN.EXE. Also, if the DTS package is accessing resources other than on the local machine, you will need to grant permission for that as well.

DTSRun doesn't complete

From a cmd prompt I am trying to DTS data out of an old version of
Btrieve to SQL Server 2000. It does the work just fine.
The last thing it displays is
DTSRun OnFinish: Copy Data from Account to [Test123].[dbo].[Account]
Step
However, at this point it just sits there and never comes back to the
command prompt.
Anyone know what may be wrong?John.Wentworth@.emersonprocess.com (JohnW) wrote in message news:<5d096b4e.0312300929.42ac5776@.posting.google.com>...
> From a cmd prompt I am trying to DTS data out of an old version of
> Btrieve to SQL Server 2000. It does the work just fine.
> The last thing it displays is
> DTSRun OnFinish: Copy Data from Account to [Test123].[dbo].[Account]
> Step
> However, at this point it just sits there and never comes back to the
> command prompt.
> Anyone know what may be wrong?
Nevermind I figured it out|||Wat was the reason for it not to come back to cmdprompt ?
jobi
"JohnW" <John.Wentworth@.emersonprocess.com> wrote in message
news:5d096b4e.0312301428.348e1a2f@.posting.google.com...
> John.Wentworth@.emersonprocess.com (JohnW) wrote in message
news:<5d096b4e.0312300929.42ac5776@.posting.google.com>...
> > From a cmd prompt I am trying to DTS data out of an old version of
> > Btrieve to SQL Server 2000. It does the work just fine.
> >
> > The last thing it displays is
> >
> > DTSRun OnFinish: Copy Data from Account to [Test123].[dbo].[Account]
> > Step
> >
> > However, at this point it just sits there and never comes back to the
> > command prompt.
> >
> > Anyone know what may be wrong?
> Nevermind I figured it out|||"jobi" <jobi@.reply2.group> wrote in message news:<bstuqh$rte$1@.reader08.wxs.nl>...
> Wat was the reason for it not to come back to cmdprompt ?
Well for some reason you have specifically set the "Close Connection
on Completion" switch. This is found in the Workflow Properties
screen, Options tab. As soon as I set this the DTS package finishes
just like it should and comes back to the command prompt.
I am trying to DTS an entire database consisting of 198 tables. I have
to go to each connection and set this. They don't give you a way to
set this across the entire package. What a pain in the ass!
> jobi
> "JohnW" <John.Wentworth@.emersonprocess.com> wrote in message
> news:5d096b4e.0312301428.348e1a2f@.posting.google.com...
> > John.Wentworth@.emersonprocess.com (JohnW) wrote in message
> news:<5d096b4e.0312300929.42ac5776@.posting.google.com>...
> > > From a cmd prompt I am trying to DTS data out of an old version of
> > > Btrieve to SQL Server 2000. It does the work just fine.
> > >
> > > The last thing it displays is
> > >
> > > DTSRun OnFinish: Copy Data from Account to [Test123].[dbo].[Account]
> > > Step
> > >
> > > However, at this point it just sits there and never comes back to the
> > > command prompt.
> > >
> > > Anyone know what may be wrong?
> >
> > Nevermind I figured it out|||So do it using the object model.
Function Main()
dim tsk
dim stp
dim pkg
dim cusTask
dim prp
set pkg = DTSGlobalVariables.Parent
for each tsk in pkg.Tasks
if tsk.CustomTaskID = "DTSDataPumpTask" THEN
for each stp in pkg.steps
if stp.TaskName = tsk.Name then
stp.Properties("CloseConnection").Value = -1
end if
Next
End if
Next
Main = DTSTaskExecResult_Success
End Function
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"JohnW" <John.Wentworth@.emersonprocess.com> wrote in message
news:5d096b4e.0312310501.9624dee@.posting.google.com...
> "jobi" <jobi@.reply2.group> wrote in message
news:<bstuqh$rte$1@.reader08.wxs.nl>...
> > Wat was the reason for it not to come back to cmdprompt ?
> Well for some reason you have specifically set the "Close Connection
> on Completion" switch. This is found in the Workflow Properties
> screen, Options tab. As soon as I set this the DTS package finishes
> just like it should and comes back to the command prompt.
> I am trying to DTS an entire database consisting of 198 tables. I have
> to go to each connection and set this. They don't give you a way to
> set this across the entire package. What a pain in the ass!
>
>
> >
> > jobi
> > "JohnW" <John.Wentworth@.emersonprocess.com> wrote in message
> > news:5d096b4e.0312301428.348e1a2f@.posting.google.com...
> > > John.Wentworth@.emersonprocess.com (JohnW) wrote in message
> > news:<5d096b4e.0312300929.42ac5776@.posting.google.com>...
> > > > From a cmd prompt I am trying to DTS data out of an old version of
> > > > Btrieve to SQL Server 2000. It does the work just fine.
> > > >
> > > > The last thing it displays is
> > > >
> > > > DTSRun OnFinish: Copy Data from Account to [Test123].[dbo].[Account]
> > > > Step
> > > >
> > > > However, at this point it just sits there and never comes back to
the
> > > > command prompt.
> > > >
> > > > Anyone know what may be wrong?
> > >
> > > Nevermind I figured it out|||thanks for the feedback.
Happy newyear.
"JohnW" <John.Wentworth@.emersonprocess.com> wrote in message
news:5d096b4e.0312310501.9624dee@.posting.google.com...
> "jobi" <jobi@.reply2.group> wrote in message
news:<bstuqh$rte$1@.reader08.wxs.nl>...
> > Wat was the reason for it not to come back to cmdprompt ?
> Well for some reason you have specifically set the "Close Connection
> on Completion" switch. This is found in the Workflow Properties
> screen, Options tab. As soon as I set this the DTS package finishes
> just like it should and comes back to the command prompt.
> I am trying to DTS an entire database consisting of 198 tables. I have
> to go to each connection and set this. They don't give you a way to
> set this across the entire package. What a pain in the ass!
>
>
> >
> > jobi
> > "JohnW" <John.Wentworth@.emersonprocess.com> wrote in message
> > news:5d096b4e.0312301428.348e1a2f@.posting.google.com...
> > > John.Wentworth@.emersonprocess.com (JohnW) wrote in message
> > news:<5d096b4e.0312300929.42ac5776@.posting.google.com>...
> > > > From a cmd prompt I am trying to DTS data out of an old version of
> > > > Btrieve to SQL Server 2000. It does the work just fine.
> > > >
> > > > The last thing it displays is
> > > >
> > > > DTSRun OnFinish: Copy Data from Account to [Test123].[dbo].[Account]
> > > > Step
> > > >
> > > > However, at this point it just sits there and never comes back to
the
> > > > command prompt.
> > > >
> > > > Anyone know what may be wrong?
> > >
> > > Nevermind I figured it out

DTSRun causes The Memory could not be "read" application error

Hi,

I've got this dts package in sql server 2000 sp4 that has several
transformation tasks with an oracle database (10g) as the destination.
The package executes successfully when run through the dts designer but
when run using dtsrun, I get the following error at the completion of
all tasks in the dts package. The data inserts into the oracle database
but i always get this Application error

The Instruction at "0x7c8327f9" referenced memory at "Oxffffffff". The
memory could not be "read"

Does anyone know how I can fix this?

Thanks
LynHi

I am not sure why this should happen but you may want to check that your
arguements are correct http://support.microsoft.com/?kbid=308801 and that
you can the same versions of MDAC on the machine it is running on and that
it is consistent (see MDAC component checker http://tinyurl.com/6gsv )
http://support.microsoft.com/?kbid=255900

John
<lyn.duong@.gmail.com> wrote in message
news:1130286935.981909.22760@.g43g2000cwa.googlegro ups.com...
> Hi,
> I've got this dts package in sql server 2000 sp4 that has several
> transformation tasks with an oracle database (10g) as the destination.
> The package executes successfully when run through the dts designer but
> when run using dtsrun, I get the following error at the completion of
> all tasks in the dts package. The data inserts into the oracle database
> but i always get this Application error
> The Instruction at "0x7c8327f9" referenced memory at "Oxffffffff". The
> memory could not be "read"
> Does anyone know how I can fix this?
> Thanks
> Lyn|||Hi John,

The mdac problem is relevant to sql server 7.0 and I've checked the
other kb. I don't pass any arguments. I have already got the latest
service pack installed for sql server 2000.

Lyn

John Bell wrote:
> Hi
> I am not sure why this should happen but you may want to check that your
> arguements are correct http://support.microsoft.com/?kbid=308801 and that
> you can the same versions of MDAC on the machine it is running on and that
> it is consistent (see MDAC component checker http://tinyurl.com/6gsv )
> http://support.microsoft.com/?kbid=255900
> John
> <lyn.duong@.gmail.com> wrote in message
> news:1130286935.981909.22760@.g43g2000cwa.googlegro ups.com...
> > Hi,
> > I've got this dts package in sql server 2000 sp4 that has several
> > transformation tasks with an oracle database (10g) as the destination.
> > The package executes successfully when run through the dts designer but
> > when run using dtsrun, I get the following error at the completion of
> > all tasks in the dts package. The data inserts into the oracle database
> > but i always get this Application error
> > The Instruction at "0x7c8327f9" referenced memory at "Oxffffffff". The
> > memory could not be "read"
> > Does anyone know how I can fix this?
> > Thanks
> > Lyn

DTSRUN /A Issue

Hi,
I have a DTS named "Rahul_Test" where i have a global variale named "Rahul" INteher (1 Byte). N trying to assign this variable from SQL statement. Here is the syntax that I am writing.

exec master..xp_cmdshell 'DTSRUN -E -S142.102.27.222 -Usa -Psa -N"Rahul_Test" -ARahul:8="aaa"'

After executing the syntax I am getting the following message...

DTSRun: Loading...
DTSRun: Executing...
DTSRun: Package execution complete.
NULL

But the global variable "Rahul" doesnot get changed to 225.

Kindly help me out in this regard.

Thanks in advance.

Rahul Jhaone qn,

"Rahul" is integer or string data type?|||Rahul is a string data type|||Have tried even with this syntax....... still it failed with the same output

exec master..xp_cmdshell 'DTSRUN -E -S142.102.27.222 -Usa -Psa -N"Rahul_Test" -A"Rahul:8"="225"'|||Rahul is String Data Type. By Mistake it was written as Integer while posting the issue........

Dtsrun

I run DTS run from the VB6 using SHELL, when i run each time new process is invoking and previous process is not closing. bcz. of this lot of memory is taking and my system is hanging. pls. help me how to resolve this.
Thank You all
D. Shyam Benagal
dsb@.inspira.com
Inspira TechnologiesA bit more information would be helpful:

1. Is the VB6 app running on the same machine as the SQL Server? or is it a different client?

2. Have you considered using SQL Agent to schedule and run the DTS package?

3. Does the prior instance of the DTS package actually terminate and finish its actions? or is it still running when the next instance pops up?

Also pls include some information regarding what the DTS package is doing, what tables/procs it references.

Regards,

Hugh Scott

Originally posted by SHYAM
I run DTS run from the VB6 using SHELL, when i run each time new process is invoking and previous process is not closing. bcz. of this lot of memory is taking and my system is hanging. pls. help me how to resolve this.
Thank You all
D. Shyam Benagal
dsb@.inspira.com
Inspira Technologies|||Thank's for u r reply Hugh Scott. That problem is rectified (some memory leak in the Pakage)

rgds
shyam

Originally posted by hmscott

A bit more information would be helpful:

1. Is the VB6 app running on the same machine as the SQL Server? or is it a different client?

2. Have you considered using SQL Agent to schedule and run the DTS package?

3. Does the prior instance of the DTS package actually terminate and finish its actions? or is it still running when the next instance pops up?

Also pls include some information regarding what the DTS package is doing, what tables/procs it references.

Regards,

Hugh Scott|||what's the sql server version?