Error Handling And Problem Resolution

Oct 28, 2007

I posted a question a few days ago, to get some general information what this command does:

command.cmd
osql -S (local)SQLEXPRESS -E -i DropDB.sql

DropDB.sql
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'Caching')
DROP DATABASE [Caching]

I have gotten some great answers. Now I like to ask a deeper question. This command was created for SQL Server Express, for an internal software package at my company, by an outside vendor. However, sometimes this command doesn't work 100% on all user computers. So I have two questions.
1. Is there any way to either enhance the command, or the database command, to provide error diagnostics, to find out the issue for an individual user computer, why it doesn't always work?
2. Can anyone think of any scenarios that would prevent this from working?
The key element here is that this caching database is supposed to allow individuals to use a particular piece of software, when they aren't connected to the network at work. But it doesn't always work on each computer - 100% of the time - even when the computer has SQL Server Express installed, and is running Windows XP.
Randy

View 2 Replies


ADVERTISEMENT

Error Handling And Problem Resolution

Oct 29, 2007


An outside vendor created this command and SQL files for internal
software, using SQL Server Express, which is installed on every user
machine


osql -S (local)SQLEXPRESS -E -i DropDB.sql
The SQL file has this:
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'Caching')
DROP DATABASE [Caching]


This command was created for SQL Server Express, for an internal software package at my company, by an outside vendor. However, sometimes this command doesn't work 100% on all user computers. So I have two questions.
1. Is there any way to either enhance the command, or the database command, to provide error diagnostics, to find out the issue for an individual user computer, why it doesn't always work?
2. Can anyone think of any scenarios that would prevent this from working?
The key element here is that this caching database is supposed to
allow individuals to use a particular piece of software, when they aren't connected to the network at work. But it doesn't always work on each computer - 100% of the time - even when the computer has SQL Server Express installed, and is running Windows XP.
Randy

View 2 Replies View Related

Recovery :: Error - Name Resolution Not Yet Available

Jul 6, 2015

I am using Allwayson to replicate a FCI to a remote site. (windows 2012R2) Although all is implemented, iam getting a strange error with the listener resources after ive made a failover test.

It keeps saying "Name resolution not yet available"from my understanding this is trying to update an entry that doesn't exist (since the user has permissions to do it).

View 4 Replies View Related

Query Error Help. (Could Not Allocate Ancillary Table For View Or Function Resolution)

Aug 8, 2007

i created a query and when i run it like this i get data but when i add a value in the 2ed case for '2%' i get error.
Select  a.email, case when a.reportnumber like '1%' then  (select b.Reportnumber  from ijasSummaryNo b  where a.Reportnumber = b.Reportnumber) end as Reportnumber, case when a.Reportnumber like '1%' then (select b.stonebreakdown  from ijasSummaryNo b  where a.Reportnumber = b.Reportnumber) end as Measurement, case when a.Reportnumber like '1%' then (select b.reportcarddate  from ijasSummaryNo b  where a.Reportnumber = b.Reportnumber) end as ijasDate,
case when a.reportnumber like '2%' then (select c.Reportnumber   from appraisalsummaryblue c  where a.reportnumber = c.reportnumber) end as imacsRepNo
from t_RegisterInfoTemp a
Query works fine like this but when i add  this (the one marked bold i get error)
case when a.reportnumber like '2%' then (select c.Reportnumber   from appraisalsummaryblue c  where a.reportnumber = c.reportnumber) end as imacsRepNo,case when a.reportnumber like '2%' then (select c.Measurement  from appraisalsummaryblue c  where a.reportnumber = c.reportnumber) end as Measurement2
 
This is the error.
Server: Msg 4414, Level 16, State 1, Line 1Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (260) was exceeded.

View 4 Replies View Related

BC30516: Overload Resolution Failed Because No Accessible 'New' Accepts This Number Of Arguments Error

Feb 18, 2008

Hello, I want to get data from datatable as below. I am getting error:
BC30516: Overload resolution failed because no accessible 'New' accepts this number of arguments.  I did not understand what is wrong. Because everything is same as msdn library.
my codebehind is:
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClientPartial Class Default2 Inherits System.Web.UI.Page
 
Private Shared Function GetConnectionString() As String
' To avoid storing the connection string in your code,
' you can retrieve it from a configuration file.
Return "Data Source=Database;Initial Catalog=otel;Integrated Security=True;Pooling=False"
End FunctionProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadDim connectionString As String = _
GetConnectionString()
' Create a SqlConnection to the database.Using connection As SqlConnection = New SqlConnection(connectionString)
 
' Create a SqlDataAdapter for the Suppliers table.Dim mailsAdapter As SqlDataAdapter = _ New SqlDataAdapter()
' A table mapping names the DataTable.mailsAdapter.TableMappings.Add("Table", "Pages")
connection.Open()Dim PagesCommand As SqlCommand = New SqlCommand( _"SELECT * FROM Pages", _
connection)
PagesCommand.CommandType = CommandType.Text
' Set the SqlDataAdapter's SelectCommand.
mailsAdapter.SelectCommand = PagesCommand
' Fill the DataSet.
Dim dataSet1 As Dataset = New Dataset("Pages") 'ERROR MESSAGE HERE...........................................mailsAdapter.Fill(dataSet1)
connection.Close()LblPageName.Text = CStr(dataSet1.Tables("Pages").Rows(0).Item(1))
TxtPageTitle.Text = CStr(dataSet1.Tables("Pages").Rows(0).Item(2))TxtPageSummary.Text = CStr(dataSet1.Tables("Pages").Rows(0).Item(3))
Rte1.Text = CStr(dataSet1.Tables("Pages").Rows(0).Item(4))TxtPageimgUrl.Text = CStr(dataSet1.Tables("Pages").Rows(0).Item(5))
End Using
End Sub
 
End Class

View 1 Replies View Related

Resolution Of Following Error: IM010: [Microsoft][ODBC Driver Manager] Data Source Name Too Long

Feb 26, 2008

Hi SQL Server Team,

In order to add a data source by using ODBC Administrator, programmatically i am using SQLConfigDataSource. Thus calling SQLConfigDataSource with the fOption set to either ODBC_ADD_DSN for creating a new DSN.

Following is the stattement specified in the source code. where type_of_driver = "Microsoft Access Driver (*.mdb)"; and parameters contains the data source source credentials information such as DSN, UID, PSW, FIL, Description, DataDirectory,DEFAULTDIR and DBQ all separated by "".

rc = SQLConfigDataSource(NULL, ODBC_ADD_DSN, type_of_driver, parameters);

after execution of below mentioned command an error is encountered i.e -1 is returned if the DataDirectory path exceeds certain nested directories link. for eg. the file path specified below.

C:My DocumentsClients CurrentAHW Netcare BenefitsDeliverables1-5 Results Chain - system LevelAlberta NetcareBenefits Logic System Level V01.rcm

Creating a datasource with the file name i.e Benefits Logic System Level V01 every time.
rc = :: SQLConnect(hDbc, (unsigned char *)szSource, SQL_NTS, (unsigned char *)szUserName, SQL_NTS, (unsigned char *)szPassword, SQL_NTS);

Also following error message was encountered during execution of SQLConnect command.

/*szErrorMsg = 0x0012e834 "[Microsoft][ODBC Microsoft Access Driver]General error Not enough information to connect to this DSN with SQLConnect. Use SQLDriverConnect."*/

Thus followed the instruction smentioned in the error message an dtried using SQL DriverConnect() in the following manner.
rc = :: SQLDriverConnect(hDbc, NULL,(SQLCHAR *)"DSN=RCM",SQL_NTS,outstr, sizeof(outstr),
&outstrlen,SQL_DRIVER_NOPROMPT);

Still an error is encountered but this time it returns a RETCODE of 100 whrease earlier it had returned -1.

Inform the procedure to be followed using SQLConnect when DataDirectory path is too long.

An early reply will be appreciated.

Cheers & Regards,

Saresh

View 1 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

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

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

TVF- Error Handling How To!

May 16, 2007

Hello,
I'm mainly a .net dev and now I want to create a TV function using the CLR inside SQL Server but I have some doubt about the error handling in the function itself and in t-sql.

I have a SP (that I suppose will have a BEGIN TRY ... END TRY BEGIN CATCH ...END CATCH) that call my TV function to get a table made of one row and 2 columns.

My TV function calls some private functions that uses .net classes so I want to handle the exception the potentially could happens.

But these expection shouldn't thrown the error to the caller SP because the SP must continue iven if there is a error but I would to inform somehow the SP that the fields in the table are null because something went wrong


What is the programming pattern to use?

If I write

<Microsoft.SqlServer.Server.SqlFunction(DataAccess:=DataAccessKind.None, FillRowMethodName:="FillDatesRow", isDeterministic:=True, Name:="GetDates", TableDefinition:="StartDate datetime,EndDate datetime")> _

Public Shared Function GetDates(ByVal UTCInputDate As Date) As IEnumerable

Dim StartDate As Date

Dim EndDate As Date

Dim rowArray As ArrayList = New ArrayList

Try

Dim GetDates (1) As Object

GetDates = Function1(UTCInputDate) 'Function that can cause exception directly or indirectly

GetDates (0) = StartDate

GetDates (0) = EndDate

rowArray.Add(GetDates)

Catch ex As Exception

????

End Try

Return rowArray

End Function



Private Shared Sub FillDatesRow(ByVal obj As Object, <Out()> ByRef StartDate As SqlDateTime, <Out()> ByRef EndDate As SqlDateTime)

Try

If obj IsNot Nothing Then

Dim row As Object() = CType(obj, Object())

If row(0) IsNot Nothing Then

StartDate = CType(row(0), DateTime)

Else

StartDate = SqlDateTime.Null

End If

If row(0) IsNot Nothing Then

EndDate = CType(row(1), DateTime)

Else

EndDate = SqlDateTime.Null

End If

Else

StartDate = SqlDateTime.Null

EndDate = SqlDateTime.Null

End If

Catch ex As Exception

Throw

End Try

End Sub



What I have to write in the GetDates' s catch block to avoid that the exception is thrown to the BEGIN CATCH END CATCH of the caller SP but inform anyway the caller??

Any tips and/or resources is welcome!



Thankx

Marina B

View 2 Replies View Related

Error Handling

Dec 24, 2007



Hey,


My flow is build with in the beginning an sql command in an OLE DB source, this command I use to create an incremental update which works faster than an SCD task.
Now when I debug the package runs but stops after a short time. One control flow with that sql statements rus perfectly but the other gives an error.
The errors I get are:

- [OLE DB Source 1 [2946]] Error: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.

- [DTS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "OLE DB Source 1" (2946) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.

The dataflow task starts with that sql statement where afterwords I do a data conversion and then I store it in with an OLE DB destination in a table.

Now i don't know why one statement works while the other isn't working...
Does anyone has an idea?

Thanx


View 8 Replies View Related

Error Handling With Try/catch

Feb 6, 2008

Hey,Here's yet another question for you more knowledgeable than me Up to this point I have been using a try/catch statement when dealing with SQL, for exampleint result = 0;try{result = Int32.Parse(command.ExecuteScalar().ToString());}catch{result = 0;}But I read up one some error handling and I have no idea how to solve this anymore. Since I'll be using the catch block to catch exceptions, something like thiscatch (SqlException){throw;}So I was wondering what is the good, standard practice for dealing with this since I need the catch statement to set result to zero or I would end up with an error.Thanks in advance,Sixten 

View 2 Replies View Related

EXEC And Error Handling

Sep 2, 2004

I am building a Bulk Insert statement dynamically passing in filename location, etc.

I have coded error handling via the @@ERROR. To test the error handling, I am forcing the file that is bulk inserted to be missing.

The statement is created in a declared variable, IE @SQL:

EXEC(@SQL)

IF @@ERROR <> 0

BEGIN
GOTO ErrorHandler
END


Since the file is missing it causes an error, and the Stored Procedure gives the

Server: Msg 4860, Level 16, State 1, Line 1 Could not find the file etc.
and aborts aborts the whole stored proc at that point. In other words the error handling IF @@ERROR doesn't trap the error and send the process to the error handler routine.

Is there anyway to get the error back from the EXEC, or maybe something has to be set to trap the error because it is fatal? Because of the way the Bulk Insert statement is created dynamically, it appears you have to EXEC the statement once it is built (EXEC(@SQL)).

Any help would be appreciated.

Barry

View 1 Replies View Related

Error Handling With SQLDataSource

Apr 4, 2006

Hello to all
I am having a SQLDataSource on my web page to connect with database. Now If it generates any error then where to capture that errors ?? Means at which place(which event or any other place) should i write code for handeling errors ???

View 7 Replies View Related







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