Showing posts with label step. Show all posts
Showing posts with label step. Show all posts

Tuesday, March 27, 2012

DTS Fail when IDENTITY(1,1)

Hi,

i m facing this error when running DTS on IDENTITY(1,1) Field.
how can this field increment automatically ?

Step Error Source: Microsoft Data Transformation Services (DTS) Data Pump
Step Error Description:The number of failing rows exceeds the maximum specified. (Microsoft Data Transformation Services (DTS) Data Pump (80040e21): Insert error, column 14 ('s_no', DBTYPE_I4), status 10: Integrity violation; attempt to insert NULL data or data which violates constraints.) (Microsoft OLE DB Provider for SQL Server (80040e21): Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.)
Step Error code: 8004206ADon't include any tranformation for the IDENTITY column. In other words, have DTS ignore that column and let the database engine deal with it.

-PatP|||there is a option button (check box) in your transformation task that says
"enable identity insert"
change that.|||Does the table have existing data?

Does your import file have existing "keys" (boy I hate to use that word here) that need to be imported into that column?

Does this import need to update as well as add data (or delete)?|||Hi,
Actually guys i have not run the DTS wizard to transform data i have written my own dts package that transfer hetrogenous data from one table to another.

e.g

Table1
mfg_no varchar(255)
Product_Name varchar(255)
Description varchar(255)

Table2
s_no int IDENTITY(1,1) Not Null {constraint for identity seed 1)
mfgno varchar(255)
ProductName varchar(255)

i just have to transfer data column (mfgno and product name) from Table1 to Table 2. the problem is that when i run dts its not inserting "s_no" automatically in Table 2 (i hope SQL server should handle this but its not working). if i remove constraint of identity (s_no)and make it allow Null then data transfer successfully.

i m using DTSDataPump in package to transform data.

waiting for ur reply|||Does the table have existing data?
NO

Does your import file have existing "keys" (boy I hate to use that word here) that need to be imported into that column?
NO there is no existing keys in SourceTable

Does this import need to update as well as add data (or delete)?
No it just Add data|||ctually guys i have not run the DTS wizard to transform data i have written my own dts package that transfer hetrogenous data from one table to another.That is what I thought... Just view the transform code, and remove any transformation for the IDENTITY column. It ought to be pretty simple.

-PatP|||Don't include any tranformation for the IDENTITY column. In other words, have DTS ignore that column and let the database engine deal with it.

-PatP

yes i have't include any transformation for the identity column and i m wonder why db engine not handle this :mad:|||I don't get it...

USE Northwind
GO

SET NOCOUNT ON
CREATE TABLE Table1(mfg_no varchar(255), Product_Name varchar(255), [Description] varchar(255))
CREATE TABLE Table2(s_no int IDENTITY(1,1) Not Null, mfgno varchar(255), ProductName varchar(255))
GO

INSERT INTO Table1 (mfg_no, Product_Name, [Description])
SELECT 'x002548','Gas Powered Blenders', 'The Ultimate is finally here' UNION ALL
SELECT 'x002548','Shake, rattle and Roll Mixers', 'Get the Party started' UNION ALL
SELECT 'x002548','1.75 litre sampler packages', '6 Bottles of unconciousness' UNION ALL
SELECT 'x002548','Margarita Glasses', 'Glasses, Hell you wont be able to see, son' UNION ALL
SELECT 'x002548','Hide away Car Key Chain', 'inebriation Dector - will hide your keys on you'
GO

SELECT * FROM Table1
GO

INSERT INTO Table2(mfgno, ProductName)
SELECT mfg_no, Product_Name FROM Table1
GO

SELECT * FROM Table2
GO

SET NOCOUNT ON
DROP TABLE table1
DROP TABLE table2
GO|||I don't get it...
[/code]

u run direct quries its working fine :( but if i run dts package then it fails :(|||That's what I don't get.

Why are you bothering with a DTS package at all?|||That's what I don't get.

Why are you bothering with a DTS package at all?

i want to tranfer data from one table to another on schedule basis so that i need a DTS package that tranfer only those column data that i want to tranfer.

whole dts working fine its transform the desired column to anothe table but when identiy column is removed cuz destination table has a unique column type int and identity seed 1.

:( this is sample code u can run it . if u remove constraint on s_no it will work fine. try this

CREATE TABLE [DTS_UE].[dbo].[NorthwindProducts] (
[s_no] [int] IDENTITY(1,1) Not NULL ,
[ProductName] [nvarchar] (40) NULL ,
[CategoryName] [nvarchar] (25) NULL ,
[CompanyName] [nvarchar] (40) NULL )
This is the Visual Basic code for the application:

Public Sub Main()
'Copy Northwind..Products names, categories, suppliers to DTS_UE..NorthwindProducts.
Dim objPackage As DTS.Package2
Dim objConnect As DTS.Connection2
Dim objStep As DTS.Step2
Dim objTask As DTS.Task
Dim objPumpTask As DTS.DataPumpTask2
Dim objTransform As DTS.Transformation2
Dim objLookUp As DTS.Lookup
Dim objTranScript As DTSPump.DTSTransformScriptProperties2
Dim sVBS As String 'VBScript text

Set objPackage = New DTS.Package
objPackage.FailOnError = True
objPackage.LogFileName = "C:\Temp\TestConcurrent.Log"

'Establish connections to data source and destination.
Set objConnect = objPackage.Connections.New("SQLOLEDB.1")
With objConnect
.ID = 1
.DataSource = "(local)"
.UseTrustedConnection = True
End With
objPackage.Connections.Add objConnect
Set objConnect = objPackage.Connections.New("SQLOLEDB.1")
With objConnect
.ID = 2
.DataSource = "(local)"
.UseTrustedConnection = True
End With
objPackage.Connections.Add objConnect

'Create copy step and task, link step to task.
Set objStep = objPackage.Steps.New
objStep.Name = "NorthwindProductsStep"
Set objTask = objPackage.Tasks.New("DTSDataPumpTask")
Set objPumpTask = objTask.CustomTask
objPumpTask.Name = "NorthwindProductsTask"
objStep.TaskName = objPumpTask.Name
objStep.ExecuteInMainThread = False
objPackage.Steps.Add objStep

'Link copy task to connections.
With objPumpTask
.SourceConnectionID = 1
.SourceSQLStatement = _
"SELECT ProductName, CategoryID, SupplierID " & _
"FROM Northwind..Products"
.DestinationConnectionID = 2
.DestinationObjectName = "[DTS_UE].[dbo].[NorthwindProducts]"
.UseFastLoad = False
.MaximumErrorCount = 99
End With

'Create lookups for supplier and category.
Set objLookUp = objPumpTask.Lookups.New("CategoryLU")
With objLookUp
.ConnectionID = 1
.Query = "SELECT CategoryName FROM Northwind..Categories " & _
"WHERE CategoryID = ? "
.MaxCacheRows = 0
End With
objPumpTask.Lookups.Add objLookUp
Set objLookUp = objPumpTask.Lookups.New("SupplierLU")
With objLookUp
.ConnectionID = 1
.Query = "SELECT CompanyName FROM Northwind..Suppliers " & _
"WHERE SupplierID = ? "
.MaxCacheRows = 0
End With
objPumpTask.Lookups.Add objLookUp

'Create and initialize rowcount and completion global variables.
objPackage.GlobalVariables.AddGlobalVariable "Copy Complete", False
objPackage.GlobalVariables.AddGlobalVariable "Rows Copied", 0
objPackage.ExplicitGlobalVariables = True

'Create transform to copy row, signal completion.
Set objTransform = objPumpTask.Transformations. _
New("DTSPump.DataPumpTransformScript")
With objTransform
.Name = "CopyNorthwindProducts"
.TransformPhases = DTSTransformPhase_Transform + _
DTSTransformPhase_OnPumpComplete
Set objTranScript = .TransformServer
End With
With objTranScript
.FunctionEntry = "CopyColumns"
.PumpCompleteFunctionEntry = "PumpComplete"
.Language = "VBScript"
sVBS = "Option Explicit" & vbCrLf
sVBS = sVBS & "Function CopyColumns()" & vbCrLf
sVBS = sVBS & " DTSDestination(""ProductName"") = DTSSource(""ProductName"") " & vbCrLf
sVBS = sVBS & " DTSDestination(""CategoryName"") = DTSLookups(""CategoryLU"").Execute(DTSSource(""CategoryID"")) " & vbCrLf
sVBS = sVBS & " DTSDestination(""CompanyName"") = DTSLookups(""SupplierLU"").Execute(DTSSource(""SupplierID"").Value) " & vbCrLf
sVBS = sVBS & " DTSGlobalVariables(""Rows Copied"") = CLng(DTSTransformPhaseInfo.CurrentSourceRow)" & vbCrLf
sVBS = sVBS & " CopyColumns = DTSTransformStat_OK" & vbCrLf
sVBS = sVBS & "End Function" & vbCrLf

sVBS = sVBS & "Function PumpComplete()" & vbCrLf
sVBS = sVBS & " DTSGlobalVariables(""Copy Complete"") = True" & vbCrLf
sVBS = sVBS & " PumpComplete = DTSTransformStat_OK" & vbCrLf
sVBS = sVBS & "End Function" & vbCrLf

.Text = sVBS
End With
objPumpTask.Transformations.Add objTransform
objPackage.Tasks.Add objTask

objPackage.Execute

End Sub

Sunday, March 25, 2012

Dts Execute Problem

Hi all,
My dts fails in step 3 when i run it from asp.net. But it works fine in when i run in Designer.
In step 3, it reads some data from a text source (on a shared place). And it gives me error :

Step Error Source: Microsoft Data Transformation Services Flat File Rowset Provider
Step Error Description:Error opening datafile: Logon failure: unknown user name or bad password.

Step Error code: 80004005
Step Error Help FileBig SmileTSFFile.hlp
Step Error Help Context ID:0

I know that when i run it on Designer, it works by my current Windows Loginname. And when i execute dts in asp.net page, it works by SqlAgent's login name. And also i made SqlAgent's Username (as a Domain UserName) a Local Admin in the file shared server.

Any idea?

Regards..

It appears that your ASP.NET application does not have permission to access the flat file.

However, it is very unlikely that your ASP.NET application is running in the context of the SQL Agent account.

How are you launching the package - using the API in your code, or calling sp_start_job?

|||I think my ASP:NET application has permission because i can get list of that folder's files and can edit one of them.
My application runs with my current AD username/password.
I use Interop.DTS class to run Dts. I can run other dts correctly with this method but i can't run this one.

Regards..

DTS Error handling

Hi,

I'm trying to decide on the best method for dealing with errors in a DTS package. It is sufficient to retrieve Step failure information after package execution but I have tried both methods. Specifically, these methods are detailed in http://support.microsoft.com/kb/240221. Another article - http://support.microsoft.com/default.aspx?scid=kb;en-us;321525 - details the need to establish a single event sink to avoid "unexpected behaviour". I have used the code as described but noticed very little difference between post execution checking using GetExecutionErrorInfo and the PackageEventSink Interface. Using the Event Sink does retrieve one extra type of error, ie.

"Error at Destination for Row number 2. Errors encountered so far in this task: 1". This error will always give the row number as the last row in the file, in this case an excel file source. This is not really useful, but I don't want to detach the Event Sink because of the possibility of "unexpected behaviour". Could somebody advise? First is it possible to retrieve the line number, and secondly can anyone detail what an example of this unexpected behaviour might be? Finally, is there a way to retrieve a unique key constraint violation from a package if it occurs? It is only caught in the generalised way and produced as "Error at Destination...".

Thanks in advance

Please see the DTS group: http://groups.google.com/group/microsoft.public.sqlserver.dts?lnk=srg
|||This forum is specific to SSIS, the replacement for DTS in 2005. You might have better success posting here: http://groups.google.com/groups?as_q=Html+mail&as_ugroup=microsoft.public.sqlserver.dts

DTS ERror Email

I have created a DTS package.
When a step in the package fails i would like to be emailed with the error
details.
I have managed to make the Package email me with the 'Send Email Task'
feature, but can;t seem to get the error details.
Any ideas?
You'd have to have the eMail Task send query output as part of the message
or as an attachment. The query you'd execute would be against the package
logs, given that you've enabled package logging.
The logs are stored in the msdb system database. There are logs for the
packages, steps, and tasks, seperately, but you can write a query against
them to extract out which ones ran, at what times, and whether or not any of
them had errors. The package log will give you just generic success and/or
failure information.
Sincerely,
Anthony Thomas

"Grant Merwitz" <grant@.magicalia.com> wrote in message
news:e1NsqMq4EHA.208@.TK2MSFTNGP12.phx.gbl...
I have created a DTS package.
When a step in the package fails i would like to be emailed with the error
details.
I have managed to make the Package email me with the 'Send Email Task'
feature, but can;t seem to get the error details.
Any ideas?
sql

DTS ERror Email

I have created a DTS package.
When a step in the package fails i would like to be emailed with the error
details.
I have managed to make the Package email me with the 'Send Email Task'
feature, but can;t seem to get the error details.
Any ideas?You'd have to have the eMail Task send query output as part of the message
or as an attachment. The query you'd execute would be against the package
logs, given that you've enabled package logging.
The logs are stored in the msdb system database. There are logs for the
packages, steps, and tasks, seperately, but you can write a query against
them to extract out which ones ran, at what times, and whether or not any of
them had errors. The package log will give you just generic success and/or
failure information.
Sincerely,
Anthony Thomas
"Grant Merwitz" <grant@.magicalia.com> wrote in message
news:e1NsqMq4EHA.208@.TK2MSFTNGP12.phx.gbl...
I have created a DTS package.
When a step in the package fails i would like to be emailed with the error
details.
I have managed to make the Package email me with the 'Send Email Task'
feature, but can;t seem to get the error details.
Any ideas?

Thursday, March 22, 2012

DTS Error

In trying to run a step in a DTS package, I get this error
on SQL 2000 running on Windows 2000.
"The DTS cannot copy or transform data from a desktop or
MSDE Server to a standard, Enterprise of small business
version of SQL SERVER unless your destination server is
per user licensing mode."
I thought the error was WIndows 2000 licensing error. The
licensing is set to per seat. Anyone know how I could
fixe this?
Mitch,
[vbcol=seagreen]
In the context of the error message, I think it refers to SQL2000 licensing
in the destination server.Can you post the output of the below commands on
both source and destination servers ?
SELECT SERVERPROPERTY('PRODUCTLEVEL')
SELECT SERVERPROPERTY('LICENSETYPE')
SELECT SERVERPROPERTY('EDITION')
Dinesh
SQL Server MVP
--
SQL Server FAQ at
http://www.tkdinesh.com
"Mitch Orndorff" <orndorffm@.hotmail.com> wrote in message
news:1845c01c44a77$e7328d30$a301280a@.phx.gbl...
> In trying to run a step in a DTS package, I get this error
> on SQL 2000 running on Windows 2000.
> "The DTS cannot copy or transform data from a desktop or
> MSDE Server to a standard, Enterprise of small business
> version of SQL SERVER unless your destination server is
> per user licensing mode."
> I thought the error was WIndows 2000 licensing error. The
> licensing is set to per seat. Anyone know how I could
> fixe this?
|||I work with Mitch Orndorff. Here is the results of the select
statements:
SELECT SERVERPROPERTY('PRODUCTLEVEL') SP3
SELECT SERVERPROPERTY('LICENSETYPE') DISABLED
SELECT SERVERPROPERTY('EDITION') Personal Edition
I checked the same on the server we are replacing, and the LICENSETYPE
is set to PER_SEAT. So, I understand we need to change the new server
to PER_SEAT licensing. The question is, how? (Please don't tell me a
reinstall). Thank you in advance for any help you can provide.
"Dinesh T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message news:<#EK9vSCVEHA.3788@.TK2MSFTNGP12.phx.gbl>...[vbcol=seagreen]
> Mitch,
> In the context of the error message, I think it refers to SQL2000 licensing
> in the destination server.Can you post the output of the below commands on
> both source and destination servers ?
> SELECT SERVERPROPERTY('PRODUCTLEVEL')
> SELECT SERVERPROPERTY('LICENSETYPE')
> SELECT SERVERPROPERTY('EDITION')
> --
> Dinesh
> SQL Server MVP
> --
> --
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Mitch Orndorff" <orndorffm@.hotmail.com> wrote in message
> news:1845c01c44a77$e7328d30$a301280a@.phx.gbl...
sql

DTS Error

In trying to run a step in a DTS package, I get this error
on SQL 2000 running on Windows 2000.
"The DTS cannot copy or transform data from a desktop or
MSDE Server to a standard, Enterprise of small business
version of SQL SERVER unless your destination server is
per user licensing mode."
I thought the error was Windows 2000 licensing error. The
licensing is set to per seat. Anyone know how I could
fixe this?Mitch,

In the context of the error message, I think it refers to SQL2000 licensing
in the destination server.Can you post the output of the below commands on
both source and destination servers ?
SELECT SERVERPROPERTY('PRODUCTLEVEL')
SELECT SERVERPROPERTY('LICENSETYPE')
SELECT SERVERPROPERTY('EDITION')
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Mitch Orndorff" <orndorffm@.hotmail.com> wrote in message
news:1845c01c44a77$e7328d30$a301280a@.phx
.gbl...[vbcol=seagreen]
> In trying to run a step in a DTS package, I get this error
> on SQL 2000 running on Windows 2000.
> "The DTS cannot copy or transform data from a desktop or
> MSDE Server to a standard, Enterprise of small business
> version of SQL SERVER unless your destination server is
> per user licensing mode."
> I thought the error was Windows 2000 licensing error. The
> licensing is set to per seat. Anyone know how I could
> fixe this?|||I work with Mitch Orndorff. Here is the results of the select
statements:
SELECT SERVERPROPERTY('PRODUCTLEVEL') SP3
SELECT SERVERPROPERTY('LICENSETYPE') DISABLED
SELECT SERVERPROPERTY('EDITION') Personal Edition
I checked the same on the server we are replacing, and the LICENSETYPE
is set to PER_SEAT. So, I understand we need to change the new server
to PER_SEAT licensing. The question is, how? (Please don't tell me a
reinstall). Thank you in advance for any help you can provide.
"Dinesh T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message news:<#EK9vSCVEHA.3788@.TK2
MSFTNGP12.phx.gbl>...[vbcol=seagreen]
> Mitch,
>
> In the context of the error message, I think it refers to SQL2000 licensin
g
> in the destination server.Can you post the output of the below commands on
> both source and destination servers ?
> SELECT SERVERPROPERTY('PRODUCTLEVEL')
> SELECT SERVERPROPERTY('LICENSETYPE')
> SELECT SERVERPROPERTY('EDITION')
> --
> Dinesh
> SQL Server MVP
> --
> --
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Mitch Orndorff" <orndorffm@.hotmail.com> wrote in message
> news:1845c01c44a77$e7328d30$a301280a@.phx
.gbl...

DTS Error

In trying to run a step in a DTS package, I get this error
on SQL 2000 running on Windows 2000.
"The DTS cannot copy or transform data from a desktop or
MSDE Server to a standard, Enterprise of small business
version of SQL SERVER unless your destination server is
per user licensing mode."
I thought the error was WIndows 2000 licensing error. The
licensing is set to per seat. Anyone know how I could
fixe this?Mitch,
>> I thought the error was WIndows 2000 licensing error.
In the context of the error message, I think it refers to SQL2000 licensing
in the destination server.Can you post the output of the below commands on
both source and destination servers ?
SELECT SERVERPROPERTY('PRODUCTLEVEL')
SELECT SERVERPROPERTY('LICENSETYPE')
SELECT SERVERPROPERTY('EDITION')
--
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Mitch Orndorff" <orndorffm@.hotmail.com> wrote in message
news:1845c01c44a77$e7328d30$a301280a@.phx.gbl...
> In trying to run a step in a DTS package, I get this error
> on SQL 2000 running on Windows 2000.
> "The DTS cannot copy or transform data from a desktop or
> MSDE Server to a standard, Enterprise of small business
> version of SQL SERVER unless your destination server is
> per user licensing mode."
> I thought the error was WIndows 2000 licensing error. The
> licensing is set to per seat. Anyone know how I could
> fixe this?|||I work with Mitch Orndorff. Here is the results of the select
statements:
SELECT SERVERPROPERTY('PRODUCTLEVEL') SP3
SELECT SERVERPROPERTY('LICENSETYPE') DISABLED
SELECT SERVERPROPERTY('EDITION') Personal Edition
I checked the same on the server we are replacing, and the LICENSETYPE
is set to PER_SEAT. So, I understand we need to change the new server
to PER_SEAT licensing. The question is, how? (Please don't tell me a
reinstall). Thank you in advance for any help you can provide.
"Dinesh T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message news:<#EK9vSCVEHA.3788@.TK2MSFTNGP12.phx.gbl>...
> Mitch,
> >> I thought the error was WIndows 2000 licensing error.
> In the context of the error message, I think it refers to SQL2000 licensing
> in the destination server.Can you post the output of the below commands on
> both source and destination servers ?
> SELECT SERVERPROPERTY('PRODUCTLEVEL')
> SELECT SERVERPROPERTY('LICENSETYPE')
> SELECT SERVERPROPERTY('EDITION')
> --
> Dinesh
> SQL Server MVP
> --
> --
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Mitch Orndorff" <orndorffm@.hotmail.com> wrote in message
> news:1845c01c44a77$e7328d30$a301280a@.phx.gbl...
> > In trying to run a step in a DTS package, I get this error
> > on SQL 2000 running on Windows 2000.
> >
> > "The DTS cannot copy or transform data from a desktop or
> > MSDE Server to a standard, Enterprise of small business
> > version of SQL SERVER unless your destination server is
> > per user licensing mode."
> >
> > I thought the error was WIndows 2000 licensing error. The
> > licensing is set to per seat. Anyone know how I could
> > fixe this?

Sunday, March 11, 2012

DTS and "SQL Server does not exist or access denied"

I recently had a problem with a process that had been working, well, forever
.
The process starts a DTS package step (SQL Server 2000, Windows Server 2003
on both machines; both machines are in the same domain, behind our firewall)
that copies records from one server to another. For some reason, it returned
the "SQL Server does not exist or access denied" error. The problem started
abruptly on Dec 8, 2005.
I noticed after a while that the the process always died after the same
number of records, 3950 +- 3. On a whim, just for kicks, I went into debug
and ran the VB6 program that creates the DTS package and set the
InsertCommitSize to 100 (it had been zero), and this cleared up the error.
My questions are:
1) Has anyone else run into this?
2) It looks like something out there didn't like the size of the buffer I
sent to it. Does anyone know why?
3) Does the size of the BLOB have anything to do with this?
I'd appreciate any response I can get from anyone else who has run into
this, and what they may have done to fix it when they got it.hi Mike,
How odd! I've got about 600 dts running on day-to-day basis and neither of
them own that property to 100, always own zero. I experienced problems with
'Copy objects' task when source database own field with data type as 'text',
for example.
--
current location: alicante (es)
"MikeM in Sac" wrote:

> I recently had a problem with a process that had been working, well, forev
er.
> The process starts a DTS package step (SQL Server 2000, Windows Server 200
3
> on both machines; both machines are in the same domain, behind our firewal
l)
> that copies records from one server to another. For some reason, it return
ed
> the "SQL Server does not exist or access denied" error. The problem starte
d
> abruptly on Dec 8, 2005.
> I noticed after a while that the the process always died after the same
> number of records, 3950 +- 3. On a whim, just for kicks, I went into debug
> and ran the VB6 program that creates the DTS package and set the
> InsertCommitSize to 100 (it had been zero), and this cleared up the error.
> My questions are:
> 1) Has anyone else run into this?
> 2) It looks like something out there didn't like the size of the buffer I
> sent to it. Does anyone know why?
> 3) Does the size of the BLOB have anything to do with this?
> I'd appreciate any response I can get from anyone else who has run into
> this, and what they may have done to fix it when they got it.

Wednesday, March 7, 2012

DTS - SQL Task question

Hi,

I have a DTS package. One of the steps is SQL task step. I have the following code under SQL statment.

declare
@.p_dtProcessDate DateTime,
@.p_iResultCode int
SET @.p_dtProcessDate = getdate()
EXEC SPCreateMLRDailyRpt @.p_dtProcessDate,@.p_iResultCode out

I want to evaluate @.p_iResultCode and if it is not equal to zero, I want to make this SQL task step to be failed so that the entire DTS package itself fails.

Does any one know how to do this ? I appreciate all your help.

-BheemNot that familure with DTS but how about RAISERROR?|||Paul,

Thanx for the response. But that does not fail the step. It says DTS package completed successfully.

-Bheem|||Using RAISERROR is the correct answer. Please post your code that did not function correctly using RAISERROR.|||A RAISERROR will trigger the 'On Failure' workflow. This was used in the flowing past post

Problem with package creation (http://dbforums.com/showthread.php?s=&threadid=314650)|||My code is below.

declare @.p_iResultCode int

EXEC spValidateCLLITemp @.p_iResultCode out
IF @.p_iResultCode = 0
RAISERROR('Failed',16,1)

When I run the same query using query analyzer, RAISERROR works fine with the message displayed as 'Failed'.

But in DTS the SQL task step is completed successfully without any problem. What am I doing wrong here ?

Thanx for all the responses.

-Bheem|||Have you tried the same code but leaving out the "if" statement ? Basically, forcing a RAISERROR.|||Yes, I did. It is not working either. Basically RAISERROR is not finctioning in DTS.

Does anyone know why this code is not working ?

-Bheem|||What version/service pack of sql server are you using ?|||I am using

SQL Server 7.0
Version 4.0
Service pack 6

If I use the following in DTS SQL task it works.

declare @.test int
set @.test = 0
if @.test = 0
RAISERROR('Failed', 16,1)

But RAISERROR is not working when I use EXEC <stored proc>
Thanx..
-Bheem|||I've created a small DTS package to test RAISERROR. I use a OLEDB connect that points to the local server and Pubs database using NT authentication. It starts with a SQL Task that get the milliseconds of the current time using DATEPART. If the value is less than 500 then RAISERROR and else do nothing. The SQL Task has 2 workflows ON SUCCESS and ON FAILURE, each with a message box. I've attached the DTS package see if you can run this.

I had to rename the extension from .DTS to .TXT so that I could attach|||achorozy,

The attachment is unreadable. Can you please paste your code here.

thanx..
-Bheemsen|||It's a DTS package that you can't read with notepad but import into DTS using Enterprise Manager.

Long form:

1) Create OLEDB connection to any database
2) Create SQL Task, set connection to OLEDB created in (1). Set SQL statement toif (SELECT DATEPART(ms,GETDATE())) < 500
raiserror('',16,1)
3) Create ActiveX Script called Good, code
Function Main()
Msgbox "Good"
Main = DTSTaskExecResult_Success
End Function
5) Set workflow 'ON SUCCESS' from SQL Task to ActiveX 'Good'
6) Create ActiveX Script called Bad, code
Function Main()
Msgbox "Bad"
Main = DTSTaskExecResult_Success
End Function
7) Set workflow 'ON FAILURE' from SQL Task to ActiveX 'Bad'

Run the package, it should flip from msgbox 'Good' to 'Bad' as the milliseconds in GETDATE() change from over 500 to under 500.|||achorozy,

Thanx for your response. Your code perfectly works. As I said, I had already tested RAISERROR with a SQL statment in the SQL task. That works.

But the RAISERROR is not working in my following code.

declare @.p_iResultCode int

EXEC spValidateCLLITemp @.p_iResultCode out
IF @.p_iResultCode = 0
RAISERROR('Failed',16,1)

When I run the same query using query analyzer, RAISERROR works fine with the message displayed as 'Failed'.

But in DTS the SQL task step says it is "completed successfully", it should fail actually. What am I doing wrong here ?

-Bheemsen|||Now I've changed my SQL Task.

I created a stored procedure :
CREATE PROC sp_Test (@.x int OUTPUT)
AS
SET NOCOUNT ON

SELECT @.x = DATEPART(ms,GETDATE())
Then I modified my SQL Task's SQL Statement to be
declare @.x int

exec sp_Test @.x OUTPUT

IF (@.x < 500)
raiserror('',16,1) This works fine for me. I get the RAISERROR sometimes (@.x < 500) and sometomes not (@.x >= 500).|||Are you still having the problem ?|||rnealejr,

Yes, I still have the problem. It is really weird. The same code works well in query analyzer, but not in DTS sql task step. It never fails there.

Your code is very perfect. It is wroking fine in DTS sql step as well as in query analyzer.

Looks like may be something wrong with my procedure. It is working fine when I write a small stored procedure and test the same return code in sql task step.

It is still a mystery for me.

Thanx for all responses. Please let me know if you find something for me. All the information regarding my problem is in this thread.

-Bheemsen|||There is a problem with the OLEDB provider for SQL. You need to download the latest mdac for your machine. If install version 2.6 or greater you should be ok. This should correct the non-failure in your dts script. If not, let me know.

Good luck.|||rnealejr,

I am sorry to ask this question. How do I check my OLEDB version and from where I should download the latest mdac ?

Thanx for all your help.
-Bheemsen|||Search for sqloledb.dll - right click on the file and go to properties - go to the version tab. Let me know which version you have installed.|||The OLEDB version installed is 07.01.0819

When I run "select @.@.version" in query analyzer, I got the following.

Microsoft SQL Server 7.00 - 7.00.842 (Intel X86)
Mar 2 2000 06:49:37
Copyright (c) 1988-1998 Microsoft Corporation
Desktop Edition on Windows NT 4.0 (Build 1381: Service Pack 6)

Thanx..
-Bheemsen|||Go to the following web site for mdac version 2.6:

mdac (http://www.microsoft.com/data/download_260rtm.htm)

After the installation, make a note as to which version is installed now. It should begin with 2000. You can also upgrade to 2.7 version.
FYI: There is a service pack for 2.6.

Good luck.|||rnealejr,

Thanx a million for all that help. It worked like a charm. It looks like this bug fix is incorporated by Microsoft in its recent SP4 also. I had installed SP4 too on my machine. I need to inform my production support people to install the same.

Thanx again.
-Bheemsen|||Good deal. Be careful, because not even sp4 has the latest drivers and your dts problem will still be around. You can test it out on your existing servers and let me know (or uninstall the sp4 on your machine).

Good luck.|||Thanx. I will. How did you figure out this fix ??

Also, when you have time, can you please take a look at my another question at thread "Delete query to remove duplicate rows"

-Bheemsen