Help With Error Handling Please Strored Procedures

Dec 31, 2004

I've got the folloing stored procedure








ALTER PROCEDURE AddUserData


(@login varchar (8),


@password varchar (8),


@fullName varchar (50),


@RoleID Int,


@statusID Int)


AS





if exists


(SELECT login, @errorReturn


FROM tbEmployee


WHERE login = @login)


return 55555


Else


INSERT INTO tbEmployee (login, password, fullname, RoleID, statusId)


VALUES (@login, @password, @fullName, @RoleID, @statusID)





RETURN @@error








the function that calls this stored procedure is this








Public Shared Function InsertUserData(ByVal login As String, ByVal password As String, ByVal fullName As String, ByVal StatusID As Integer, ByVal RoleID As Integer)





' Create the connection object


Dim connection As New SqlConnection(connectionString)


' Create and initilise the command object


Dim command As New SqlCommand("AddUserData", connection)


command.CommandType = CommandType.StoredProcedure


command.Parameters.Add("@password", SqlDbType.VarChar)


command.Parameters("@password").Value = password


command.Parameters.Add("@login", SqlDbType.VarChar)


command.Parameters("@login").Value = login


command.Parameters.Add("@fullName", SqlDbType.VarChar)


command.Parameters("@fullName").Value = fullName


command.Parameters.Add("@roleID", SqlDbType.Int)


command.Parameters("@roleID").Value = RoleID


command.Parameters.Add("@statusID", SqlDbType.Int)


command.Parameters("@statusID").Value = StatusID


' Open the connection


Try





connection.Open()


command.ExecuteNonQuery()





Finally


connection.Close()


End Try





End Function








now I'm trying to get ahold of the return value from the stored procedure so I can output a message to the user in a label control.





e.g the soted procedure checks to see if a user already exists if it does it returns 55555. how can I get ahold of this 55555 and place it in a variable in the function so I can then send it to another error function to display the approperate lable message ??





thanks all

View 3 Replies


ADVERTISEMENT

Export Strored Procedures In MS Sql Server Management Studio

Jul 18, 2007

Hi,

Can anyone tell me how to export a batch of stored procedures in MS sql server Management studio?

Thanks.







View 1 Replies View Related

Transact SQL :: Error And Transaction Handling For Nested Procedures

Sep 16, 2015

We have a required to run multiple procedures in Single Go . And Error Occurred in any Procedure the it will rollback all the changes( Either all Proc run or None)

DECLARE @StartTime DATETIME=getdate(), @EndTime DATETIME=getdate()-1 , @Message VARCHAR(400)  

BEGIN TRY 
SET XACT_ABORT ON
BEGIN TRANSACTION

EXEC PROC1 @StartTime,@EndTime,@Message OUTPUT --[ Error Handling done here]
EXEC PROC2 @StartTime,@EndTime,@Message OUTPUT --[ Error Handling done here]

[Code] ....

Problem Statement is its not capturing the Error Message from Either Proc1 or Proc 2., its Capturing the Flat Message (The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction). How do i capture the Error Occurred in Proc 1 or Proc 2  into Log Tables.

View 7 Replies View Related

SQL Server 2008 :: Error Handling In Called Stored Procedures?

Apr 14, 2015

I have one main stored procedure. It calls other 10 stored procedures by giving input parameters.

Do I want to implement Begin Try/Begin catch in each sub procedures or in main procedure only.

View 2 Replies View Related

Version Handling Of Procedures?

Nov 6, 2005

I'm involved in the developement/maintanance of a database that has a lot of stored procedures. The procedures are constantly developed and it would be good to have some kind of version handling connected to them.

Is there any way to achive this?

/Lars

View 1 Replies View Related

Concurrency Handling In Stored Procedures

Jul 23, 2005

I have a requirement that requires detection of rows deleted/updated byother processes. My business objects call stored procedures to create,read, update, delete data in a SQL Server 2000 data store. I've donea fair amount of research on concurrency handling in newsgroups andother resources. Below is what I've come up as a standard forhandling concurrency thru stored procedures. I am sharing with everyoneso I can get some comments (pro/con) regarding this approach and see ifanyone can find any holes for this solution.Below is the DDL, DML and a Stored Proc demonstrating the approach. Iam using a rowversion column for concurrency checking. Another approachthat is less intrusive (doesn't require having a rowversion column inall tables) is using checksum. I may eventually use checksum but theprocess flow should be almost identical. Looking forward to anyone'scomments.Thx, BZ--xxxxxxxxxxxxxxxxxxxxxxxxxxx--IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name ='ApplicationUsers')BEGINPRINT 'Dropping Table ApplicationUsers'DROP Table dbo.ApplicationUsersENDGOPRINT 'Creating Table ApplicationUsers'GOCREATE TABLE dbo.ApplicationUsers(LoginName varchar (20) NOT NULL Primary Key,LoginPassword varchar (50) NOT NULL,LoginAttempts int NOT NULL default(0),EmailAddress varchar(25) NOT NULL Unique,DataVersion rowversion NOT NULL)GOIF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name ='UpdateUser')BEGINPRINT 'Dropping Procedure UpdateUser'DROP Procedure dbo.UpdateUserENDGOPRINT 'Creating Procedure UpdateUser'GOCreate Procedure dbo.UpdateUser@loginName Varchar (20),@loginPassword Varchar (50),@loginAttempts Int,@emailAddress Varchar(25),@dataVersion Rowversion OutputAs/************************************************** ****************************** Name: dbo.UpdateUser** Desc: Updates an Application User instance**** Parameters:** Input** @loginName** @loginPassword** @loginAttempts** @emailAddress** @dataVersion. row version used for concurrency control.**** Output** @dataVersion. updated row version used for concurrencycontrol.**** Return** 0 for Success. Error code if any are encountered** 66661 if current row version doesn't match provided version** 66666 if expected row is not found**************************************************** *****************************/Set NoCount OnDeclare@err Int,@rowCount Int,@tranCount Int--Transaction HandlingSelect @tranCount = @@TRANCOUNTIf (@tranCount=0)Begin Tran LocalTranElseSave Tran LocalTranUpdatedbo.ApplicationUsersSetLoginPassword = @loginPassword,LoginAttempts = @loginAttempts,EmailAddress = @emailAddressWhereLoginName = @loginNameAndDataVersion = @dataVersion--Check for errors and rowCount (Should have updated 1 row)Select @err = @@ERROR, @rowCount = @@ROWCOUNTIf (@err != 0) GOTO ErrHandlerIf (@rowCount != 1) GOTO ConcurrencyHandler--Set dataversion output parameterSelect@dataVersion = DataVersionFromdbo.ApplicationUsersWhereLoginName = @loginName/*If we got this far then there were no errorsIf this proc started transaction then commit it,otherwise return and let caller handle transaction*/If (@TranCount = 0)Commit Tran LocalTranReturn 0/*Rollback local transaction if an error was encountered.Return code is used to communicate error number.*/--Handle Concurrency ErrorsConcurrencyHandler:Rollback Tran LocalTranIf Exists (Select * From dbo.ApplicationUsers where LoginName =@loginName)Return 66661 --Row version doesn't match provided versionElseReturn 66666 --Row not found--Handle Other ErrorsErrHandler:Rollback Tran LocalTranReturn @err --Return Err NumberGOPRINT 'Inserting Test Data...'--Add Test DataInsert Into dbo.ApplicationUsers(LoginName, LoginPassword, LoginAttempts, EmailAddress)Values('blackmamba', 'Pwd1', default, 'bm@DIVAS.com')Insert Into dbo.ApplicationUsers(LoginName, LoginPassword, LoginAttempts, EmailAddress)Values('GoGo', 'Pwd2', default, 'gogo@crazy88.com')GO/*Call UpdateUser Stored Proc with current rowversion*/Declare @retVal int, @rowvrsn rowversion--Get Current Row Versionselect @rowvrsn = DataVersion from dbo.ApplicationUsers where LoginName= 'blackmamba'Exec @retVal = dbo.UpdateUser @loginName = 'blackmamba', @loginPassword= 'UpdatedPwd', @loginAttempts = 0, @emailAddress = 'bm@DIVAS.com',@dataVersion = @rowvrsn outputPrint @retVal --Should be 0 for successGO/*Call UpdateUser Stored Proc with out of date rowversion (simulateupdate by other process)*/Declare @retVal int, @rowvrsn rowversion--Get Current Row Versionselect @rowvrsn = DataVersion from dbo.ApplicationUsers where LoginName= 'blackmamba'--Simulate update by other processUpdate dbo.ApplicationUsers Set LoginPassword = LoginPassword whereLoginName = 'blackmamba'--Update User with out of date RowversionExec @retVal = dbo.UpdateUser @loginName = 'blackmamba', @loginPassword= 'UpdatedPwdVersion2', @loginAttempts = 0, @emailAddress ='bm@DIVAS.com', @dataVersion = @rowvrsn outputPrint @retVal --Should be 66661 for rowversion mismatchGO/*Call UpdateUser Stored Proc with out of date rowversion (simulatedelete by other process)*/Declare @retVal int, @rowvrsn rowversion--Get Current Row Versionselect @rowvrsn = DataVersion from dbo.ApplicationUsers where LoginName= 'blackmamba'--Simulate delete by other processDelete From dbo.ApplicationUsers where LoginName = 'blackmamba'--Update User with out of date RowversionExec @retVal = dbo.UpdateUser @loginName = 'blackmamba', @loginPassword= 'UpdatedPwdVersion2', @loginAttempts = 0, @emailAddress ='bm@DIVAS.com', @dataVersion = @rowvrsn outputPrint @retVal --Should be 66666 for row deleted by other process

View 2 Replies View Related

Enable Error Handling When Writing Custom Source Component /custom Error Handling Component.

Apr 21, 2006

1) We are writing a custome Source component for Oracle with OCI calls, Could some one please let me know how to Enable Error Handling for the Same,

2) Is it possible to write Custome Error Handeling Component for SSIS? if yes could you please help me on how to write it.

Thanks in advance.

View 1 Replies View Related

Error Handling In MSSQL - If Error During Call Remote Stored Prcedure I Need SQL Code To Continue...

Jul 20, 2005

Hi All,I want to catch the next MSSQL error in my SQL code with following continuecalculationsServer: Msg 17, Level 16, State 1, Line 1SQL Server does not exist or access denied.If REMOTE_SERVER_1 is inaccessible (as in (a) below) the executing of SQLwill not continue with (b) - I need the code in (b) to run despite whetherthe previous exec was successful or not - Any ideas?begin transaction(a) exec REMOTE_SERVER_1...bankinsert '1' , '1' , 1 , 0 , 0(b) print @@errorcommit transactionwhere REMOTE_SERVER_1 is link to server created byEXEC sp_addlinkedserver @server = 'REMOTE_SERVER_1', @srvproduct = '',@provider = 'SQLOLEDB', @datasrc = 'MYCOMP1', @catalog = 'mirror2'EXEC sp_addlinkedsrvlogin @rmtsrvname = 'REMOTE_SERVER_1', .....Exec sp_serveroption 'REMOTE_SERVER_1', 'data access', 'true'Exec sp_serveroption 'REMOTE_SERVER_1', 'rpc', 'true'Exec sp_serveroption 'REMOTE_SERVER_1', 'rpc out', 'true'Exec sp_serveroption 'REMOTE_SERVER_1', 'collation compatible', 'true'Any help will be greatly appreciated

View 1 Replies View Related

Strored Procedure Question

Oct 23, 2007

 
Hi All
  I am using SQL server 2005.
  I have wriiten the Stored Procedure.
  Once I modified anything in the Stored Procedure I use ALTER command and save it.
   But I am unable to save the comments with this ALTER command which I write in the beginnign of the Stored Procedure.
  I have given the example below.
 Also please tell me without using ALTER is there any way to save the stored procedure. 
  For Ex:   
/*************************************************************************************************************************************************************************************
* Procedure : pr_Generate_PaymentApproval_List
* * Called By : PPComponent.PPPayment.GetPaymentApprovalList
*  Description : This proc is use to retrieve payment approval info
*/
ALTER PROCEDURE dbo.pr_Generate_PaymentApproval_List (
@ins_id BIGINT, @disti_id BIGINT,
@geo_cd NCHAR(4) )
 --
--
Regards
Abdul
 

View 2 Replies View Related

Problem With Strored Proc

Jan 28, 2008

I have a stored Proc, which takes 30 min for execution. If I execute it twice it runs properly but when i do the same the third time, it gets stuck.. any reasoning for this..
I am using Insert into statements a lot here...

View 3 Replies View Related

TSQL Strored Procedure

Apr 26, 2006

I am having an issue when trying to pull data from Oracle into a sqlSERVER TABLE. I'm running into an issue because I am using to much temporary space in Oracle because the return set is so large. New to sqlserver, but in Oracle the solution would be to commmit the insert after so many records have been retrieved.



Here's the procedure I wrote I would think I need to add a cursor and a counter which be used to do a commit after so many rows have been retrieved. DOes so one have a procedure I could model mine after?



ALTER PROCEDURE [dbo].[SP_Load_BO]

-- Add the parameters for the stored procedure here

@p1 int = 0,

@p2 int = 0

AS

BEGIN



SET NOCOUNT ON;

INSERT INTO MERCHANT_BACKOFFICE_SQLSERVER

(MONTHYEAR,ALLIANCEID, merchantid,rptservid,scid,tabletype,tablenum,VOLUME, COST, COSTPLUS,DATELOAD)

SELECT convert(DATETIME,PERIOD) as PERIOD,

ALLIANCEID,

merchantid,

rpTSERVID,

scid,

tabletype,

tablenum,

Convert(numeric(10),Count) AS VOLUME,

Convert(numeric(24,6),COST) as COST,

Convert(numeric(24,6),COSTPLUS) as COSTPLUS,

convert(datetime,DATE_LOAD) as DATE_LOAD

from

OPENQUERY(INV,'

SELECT MER.MONTHYEAR AS PERIOD,

MER.ALLIANCEID,

MER.merchantid,

MER.RPTSERVID,

MER.SCID,

MER.TABLETYPE,

MER.TABLENUM,

SUM(MER.VOLUME) AS Count,

SUM(MER.COST) as Cost,

SUM(MER.COSTPLUS) as Costplus,

to_char((last_day(add_months(sysdate,-1))+1),''MM/DD/YYYY'') as DATE_LOAD

FROM

MERCHANT_BACKOFFICE_SERVICE MER

WHERE MER.allianceid <>516

group by MER.MONTHYEAR,

MER.ALLIANCEID,

MER.merchantid,

MER.RPTSERVID,

MER.SCID,

MER.TABLETYPE,

MER.TABLENUM')

END

View 5 Replies View Related

Error Handling - How To Suppress An Informational Error?

Nov 1, 1999

Hello,

I would like to supress an Informational error that SQL is returning when I run a stored proc that I created. The error message returned is:

Warning: Null value eliminated from aggregate.

The values returned from the stored proc are the results from a 'select * from #tmp_tbl". Before returning the values, I simply create the temp table, populate it and then run the select statement. Prior to getting my results, I get the error message. Can I suppress it and how?

Thank you.

View 1 Replies View Related

Can I Fill A Cursor From A Strored Procedure?

Nov 13, 2003

Basically, I have a complex stored procedure that combines two tables and fills a cursor.

I would like to fill another cursor in another stored procedure from the results of this first stored proc, rather than have to type it all in again.

The reason being that I am doing a one time import of some data from two tables into one new table based on some complex linking/querying.

Can I fill a cursor from the output of another stored procedure rather than an inline SELECT statement?

Does the sp I am using have to have cursor as an out parameter?

View 4 Replies View Related

Strored Proc Change Timestamp?

Jul 12, 2004

Does anyone know of an internal procedure to return the timestamp of the last time a storedprocedure or table was modified?
Currently the object only lists the creation timestamp.

View 2 Replies View Related

Handling @@error

Apr 16, 2008

Hi there,
         Can anyone help me in catching @@error value.
I have a stored procedure which return @@error value, I  need to read that in my dataaccesslayer and act according to it.
how do I catch the return value from stored procedure in my dataaccesslayer.
if I am not wrong @@error return a bool value
 
Thanks in advance.

View 1 Replies View Related

Error Handling

May 1, 2008

dear friends i am writng a store procedure to insert into a two table .table 1 data inserted but when i inserting into a table2 it have some error  at that time table 1 data also want to delete.give suggestions

View 3 Replies View Related

Error Handling

Mar 14, 2000

I am writing a stored procedure that loads transaction logs to a database and I am having trouble trapping meaningful error messages. When ever the load fails, it gives me two error messages, the first one is meaningful and the second one just states that the load ended abnormally. Unforunately, when I capture the error using @@error after the load statement, it is the second error message that I am getting.

Is there anyway to trap the first error message as well?

Thanks
Angela

View 1 Replies View Related

DTS And Error Handling

Jan 21, 1999

I currently have defined a source server, a transformation, and a destination server using DTS. How and where do I create an error routine that would capture any and all errors that would occur. This would include connection error, transformation errors etc. I know the errors can be written out to a text file but I would like them written to a table on my destination server.

The DTS package will be called from an external program using the xp_cmdshell extended stored procedure. We are using it this way as a flag so if one transformation fails it will return a 1. If all are successful it will return a O. These will be our flags to check the errors table in the destination server.

Could someone tell me where this code is to go and what the code will look like. Samples would be the most help.

Thanks

Tom

View 1 Replies View Related

Error Handling??

May 21, 2004

is there any way to do sometype of Error handling with in a Stored Proc? Example, If I have a deadlock, can I trap that error and execute other sql code or will always simply kill the stored proc?

View 1 Replies View Related

T-SQL Error Handling

Dec 12, 2006

I have a composite unique key on the audit_hub table that includes TimeStamp, UID, Type, Mailbox all as part of the unique key.

I’m trying to do inserts, and know that in some cases I will violate unique index.

I’m using stored procedure, and want to handle the error gracefully there – just move on.

Reading from text-based log files via .vbs and get back the nasty popup window.

Looks like I have it right but obviously I don’t considering how it’s (not) working.

I thought error handling would be the simplest way to avoid dupe records. Might be necessary to run the same log in more than once, and only want to add the new records since the last insert session.

Here’s what I have. It obviously simply halts and complains immediately after the insert attempt.


ALTER procedure eml_HubInsert
@TimeStamp bigint
,@UID varchar(255)
,@Type varchar(255)
,@MailBox varchar(255)
,@ServerID varchar(50)
as
insert into audit_hub (TimeStamp,UID,Type,Mailbox,ServerID)
values (@TimeStamp,@UID,@Type,@MailBox,@ServerID)

if @@ERROR = 2601
begin
return 0
end

View 2 Replies View Related

Error-Handling ?

Jul 25, 1998

Hallo... and sorry about my english

1 question:
What Error-Handling msut i mplement in a trigger, who is updating permanently two tables
in a database (with the follow commands: insert, delete and update) ???

thank you !

View 1 Replies View Related

Error Handling

Dec 5, 2005

I have some stored procedures that insert information from a third party plugin that hooks into our database (so I can't do any client side validiation). The problem I am encountering is that some of the fields I use need to be in DateTime format. In order for SQL SERVER 2000 to be able to insert this field, the Date has to be in the correct syntax or an error is thrown.

Is there any way to do something like this in SQL SERVER 2000


Code:

DELCARE @SomeDate DateTime

Try
Set @SomeDate = CONVERT(DateTime, Parameter1, 101)
Catch
return custom error describing what field is formatted
wrong and exit stored procedure
END

View 3 Replies View Related

BCP Error Handling

Mar 3, 2005

I am running some bcp copies through a Sql job. I am copying 35 tables in individual steps. However, sometimes the bcp step fails to copy the data, and I want the step to fail if the data is not copied properly. Is that possible? If so, how? Any help is greatly appreciated.

View 2 Replies View Related

Error Handling

Mar 8, 2005

I have this stored procedure that I need to add error handling to. How would I do that??

REATE PROCEDURE November2000
AS
SELECT TM#, LASTNAME, FIRSTNAME, FINALSUITDONE
FROM dbo.EmployeeGamingLicense
WHERE (FINALSUITDONE BETWEEN CONVERT(DATETIME,
'2000-11-01 00:00:00', 102) AND CONVERT(DATETIME,
'2000-11-30 00:00:00', 102))


GO

View 2 Replies View Related

T-sql Error Handling

Feb 2, 2004

ppl,

i wrote this sql, seems v.straightforward to me.
It works first time round, sets the foreigh key, but second time round should error out to the handler - but it just reports the errors to the message out and dosn't seem to fire the errhandler.

Its gotta be a simple mistake - perhaps you could show me.


DECLARE @ErrorMsg int

BEGIN TRANSACTION

ALTER TABLE TPH_GlobalProductHierarchy
ADD CONSTRAINT SalesSubGrp_fk FOREIGN KEY (SalesSubGroupingID)
REFERENCES TPH_SalesSubGrouping (ID)

SET @ErrorMsg =@@ERROR
IF @ErrorMsg <>0 GOTO ErrorHandler

PRINT 'Success'
COMMIT TRANSACTION

ErrorHandler:
IF @ErrorMsg <> 0
BEGIN
PRINT 'Rollback'
ROLLBACK TRANSACTION
END

View 1 Replies View Related

Error Handling

Apr 20, 2004

How can i use the system error messages. With RAISERROR

View 1 Replies View Related

Error Handling

Jun 4, 2008

Can i any one help regd error handling while executing stored procedure.

Sample Sequence of execution :

CREATE procedure RBI_Control_sp
as
begin
set nocount on

begin try
BEGIN TRANSACTION
--Truncating the Table in ramcovm392(fin_ods)
exec fin_ods..trun_sp

--Data Transfer From the Live Server to Dw-Server
exec fin_ods..RBI_Data_Transfer_sp

insert into fin_wh..Status_report([object_name],row,[date])
select 'Data Tranfer','SUCCESS',getdate()

COMMIT TRANSACTION
end try

begin catch
<b> [i need to insert the type of error in status report table]</b>
rollback transaction
insert into fin_wh..Status_report([object_name],row,[date])
select 'Data Tranfer','FAILURE',getdate()
end catch

set nocount off
end

View 2 Replies View Related

Error Handling!!!

Mar 8, 2006

Hi all,

I am calling some stored procedures from ASP. These strored procedures have to deal with lots of deletes and updates. So i have thought of implementing transaction commits and rollbacks. But if a rollback occurs in these stored procedures, i want to get a value back to asp page, based on this value i will run the next stored procedure.

Can anybody give me some examples for doing this.

Somebody please help me with this!!!!!!!!!

Thanks a lot in advance,
Nitu

View 4 Replies View Related

Error Handling In An SP

Jan 5, 2007

hello. below is a very simple SP i have coded to insert a user into my database. i have created a unique index for the username column on my database table. if the username already i want to convey this to my C# code which is attempting the insert. i am using a combination of TRY/CATCH, RAISERROR and @@ERROR here to achieve my aim. could somebody please look at my code and tell me if the error handling code is OK, or is it overly complicated?



AS

SET NOCOUNT ON

DECLARE @Error int;

BEGIN

BEGIN TRY
INSERT INTO Users(
Username,
Password,
FirstName,
Surname,
DateBirth,
Email,
Id_Country)
VALUES(
@Username,
@Password,
@FirstName,
@Surname,
@DateBirth,
@Email,
@Id_Country)
END TRY
BEGIN CATCH

SELECT @Error = @@ERROR;

IF @Error = 2601
RAISERROR('The username already exists.', 15, 1)
ELSE
RAISERROR('An unknown error occurred.', 15, 1)

RETURN @Error;

END CATCH

SELECT @Id_User = SCOPE_IDENTITY()

END

View 1 Replies View Related

Error Handling

Jul 3, 2007

need example on how to add event handling condetion in a package using ssis.
my package runs in a loop. the loop creates a connection to diff servers and runs a dynamic query.
i want to add a feature which would let the loop run in the event of connection failure for one server.

thanks in adv

View 1 Replies View Related

Error Handling

Sep 18, 2007

I have a stored procedure that inserts a new record into a table. The table it inserts into has a unique constraint that utilizes an identity column. Occassionally, this constraint gets violated due to the fact that the app running my stored procedure isn't the only application inserting into the table. Ideally, we would want to change the design to avoid this scenario but these are legacy applications that will eventually be sunsetted. My question is this; is there a way to handle the unique key constraint violation and prevent an exception being thrown in the app calling the stored proc? I know I can check for the error code and handle it within the stored proc but my app still gets an exception caught by the calling method. Can I prevent this from happening? I want for the insert to attempt again and if successful continue processing and not produce the exception. Any help would be greatly appreciated.

View 6 Replies View Related

Error Handling

Sep 20, 2007

hi

in analysis services when i proccess a cube i got an error that
data from the fact table isnt exists in the dimenstion table
for example fact table sales has column suplier that one of its row
has data that doesnt match with the dimension table
how can i handle this error ?
can i insert instead someyhing else so that the proccess can continue and not failed ?

Thanks

Eyal

View 1 Replies View Related

DTS Error Handling

Sep 21, 2007


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

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved