How To Handle This Linked Server Error Trap In SQL2K?

Jul 23, 2005

Below is the script. The problem is when I simulated the Oracle link
drop, my SQL2K never have to a chance to head to the GOTO section as it
dies with this error msg and exit. Any idea on a workround? Thanks.

Server: Msg 7399, Level 16, State 1, Procedure USP_Link_Check, Line 8
OLE DB provider 'MSDAORA' reported an error.
[OLE/DB provider returned message: ORA-12154: TNS:could not resolve
service name
]
OLE DB error trace [OLE/DB Provider 'MSDAORA' IDBInitialize::Initialize
returned 0x80004005: ].


----------------------------------------------
ALTER PROCEDURE [USP_Link_Check] AS

DECLARE @myERROR int -- Local @@ERROR
, @myRowCount int -- Local @@ROWCOUNT

--- Verify network connections
select *
from openquery(OraLink,'select count(*) from Oracle.table')
IF @myERROR != 0 GOTO HANDLE_ERROR

HANDLE_ERROR:
Print ' Error in Oracle Link'
RETURN @myERROR
---------------------------------------------

View 1 Replies


ADVERTISEMENT

Linked Server With SQL7 And SQL2K ...

Aug 16, 2000

Anyone of how to link a SQL2K server to a SQL7.0 server ...

I have tried and the two servers from the NT level can see and talk to each other ... but trying to link the servers is not working ...

Thanks

View 2 Replies View Related

Analysis :: How To Handle Empty Resultset From OpenQuery Call To Linked Server

Aug 17, 2015

As i have to handle the empty result set from and open query call to linked analysis server in dynamic SQL. If there is no data returning from the query then i just wanted to display message with no data.In current scenario it gives me below the error.

Msg 7357, Level 16, State 2, Line 13
Cannot process the object "MDX QUery".

The OLE DB provider "MSOLAP" for linked server "CO1BMXPSQL08" indicates that either the object has no columns or the current user does not have permissions on that object.

View 2 Replies View Related

SQL7.0, SQL2K And Linked Servers

Apr 16, 2001

I am running a SQL 2000 server (Server A) on Win2000. I have a seperate server(Server B) running SQL 7.0 on NT6.0. When I attempt to create a linked server From B to A, I am unable to connect but I am able to create a linked server from A to B and connect( but I can go the opposite direction from A to B and connect). We have another server (Server C) that is running SQL 2000 and NT6.0. We can connect from B to C (so we are assuming that issue is not one of version compatability between versions 7.0 and 2000). The server Network configurations on all the servers are the same. The only difference is Win2000. Are there any other factors we may not have considered?


Thanks.

View 1 Replies View Related

DTC Problem With Linked Servers Between SQL2k And MSDE

Sep 14, 2005

Hi, can someone help me on this

View 10 Replies View Related

Trap Sqladatasource Error

Mar 26, 2008

Hi,
I have a page with only a Datasource and a Gridview that allows Delete.  In the database there is a referential integrity (RI) to the one of the columns.  When a user tries to delete the row, the RI stops the delete and throws an error message the way it should.  But it also create a hard failure on the page.
How do I trap the error message so I can display a message "Referential Integrity denied deletion of this record." rather than having it fail ?

View 4 Replies View Related

Error Codes And How To Trap Certain Ones

Apr 10, 2006

I have a system using asp pages & ADO & SQL Server 2000, which processes files, builds a SQL insert statement from the file content and then executes it.

If the insert SQL fails, I need to know whether there was something wrong with the insert SQL, or something wrong with the database (e.g. SQL Server times out), and handle those differently,

Questions
=======
1. Is there an easy way to do this without checking against a list of error codes?
2. Can anyone point me to a list of errorcodes? Can't find this anywhere

thank you

View 6 Replies View Related

ODBC Call Failed, How To Trap Error?

Feb 9, 2006

Hi All,

I have a database with primary and Unique key contraints on SQL Server 2000. I'm front ending it with Access 2k.

I want to trap the error when the Unique key constraint is hit, but i can't capture the error number. All attempts return error 0.

The error i get is
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of UNIQUE KEY constraint 'IX_lut_Referral_Source'. Cannot insert duplicate key in object 'lut_Referral_Source'. (#2627)[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. (#3621)

I've tried the soultion given here http://support.microsoft.com/kb/q185384 but now get a Type mismatch error on errStored

SaveRecODBCErr:
' The function failed because of an ODBC error.
' Below are a list of some of the known error numbers.
' If you are not receiving an error in this list,
' add that error to the Select Case statement.
For Each errStored In DBEngine.Errors

Thanks for your help

View 1 Replies View Related

Dynamic Sql: Truncate Table: Trap @@ERROR

Jul 23, 2005

Greeting All, I have a stored proc that dynamically truncates all thetables in my databases. I use a cursor and some dynamic sql for this:......create cursorLoop through sysobjects and get all table names in my database.....exec ('truncate table ' + @TableName)Now, I want to be able to determine if an error occurred or not nad logthat error to a table in another database.However, when I try to trap the value of @@ERROR after theexec ('truncate table ' + @TableName) when an actual error occurs itfails. My error was synthetically created by placing a foreign key onthe table which precludes the option of truncation:Server: Msg 4712, Level 16, State 1, Line 1Cannot truncate table 'MyTable' because it is being referenced by aFOREIGN KEY constraint.The actual relevant code snippet is:BEGINBEGINSET @v_RowCount = (SELECT rowcntFROM sysindexesWHERE id = (SELECT idFROM sysobjectsWHERE name = @v_Name)AND indid IN (0,1))EXEC('truncate table ' + @v_Name)-- If there was an error truncating the current table.-- Write the event to the MessageLog table.IF (@@ERROR <> 0)BEGINSET @v_OutputMessage = ('There was an error ' + @v_name)INSERT INTO MessageLog (message) values (@v_outputmessage)RETURN (-1)ENDLike I was saying, when the error is generated because of the foreignkey the variable @@error is never set to 4712, in fact if I were to puta "select @@ERRROR" directly below the "exec('tru..')" statement itwould never be executed. The only thing that would show up inEnterprise Manager would be the:Server: Msg 4712, Level 16, State 1, Line 1Cannot truncate table 'MyTable' because it is being referenced by aFOREIGN KEY constraint.Any ideas as to what is going on here?Thanks, TFD.

View 3 Replies View Related

I'm Sure This Is An Easy One...Error Trap To Skip Over A Bad Object.

Mar 30, 2006

Hello, I have the following code to iterate through each view in a SQLServer and call the "sp_refreshview" command against it. It worksgreat until it finds a view that is damaged, or otherwise cannot berefreshed. Then the whole routine stops working.Can someone please help me re-write this code so that any views thatfail the "sp_refreshview" command get skipped. I'm sure it's just amatter of putting some basic error trapping into the loop, but I've hada few goes at it and failed.Many thanks.DECLARE @DatabaseObject varchar(255)DECLARE ObjectCursor CURSORFOR SELECT table_name FROM information_schema.tables WHERE table_type ='view'OPEN ObjectCursorFETCH NEXT FROM ObjectCursor INTO @DatabaseObjectWHILE @@FETCH_STATUS = 0BEGINEXEC sp_refreshview @DatabaseObjectPrint @DatabaseObject + ' was successfully refreshed.'FETCH NEXT FROM ObjectCursor INTO @DatabaseObjectENDCLOSE ObjectCursorDEALLOCATE ObjectCursorGO

View 5 Replies View Related

How To Trap DELETE Statement Conflicted With COLUMN REFERENCE Constraint Error

Oct 26, 2004

Hi,

On my aspx Web page, I want to delete a member from database table 'tblMember', but if this MemberID is used as FK in another table, I want to display a user friendlier message like "You cannot delete this member, ....." I am using Try, Catch blocks in my Web Page.

Currently it display this message:
"DELETE statement conflicted with COLUMN REFERENCE constraint 'FK_..._....' The conflict occurred in database '...', table 'tblMembers', column 'MemberID'. The statement has been terminated. "

So how should I precisely trap this error? Does anybody know what Exception is it? or what error number in SQL server?


Thanks

View 2 Replies View Related

Error Log Peppered With --&&> 'The Conversation Handle Is Missing. Specify A Conversation Handle.'

Dec 3, 2007

Hi

I'm using service broker and keep getting errors in the log even though everythig is working as expected

SQL Server 2005
Two databases
Two end points - 1 in each database
Two stored procedures:
SP1 is activated when a message enters the sending queue. it insert a new row in a table
SP2 is activated when a response is sent from the receiving queue. it cleans up the sending queue.

I have a table with an update trigger
In that trigger, if the updted row meets a certain condition a dialogue is created and a message is sent to the sending queue.
I know that SP1 and SP2 are behaving properly because i get the expected result.
Sp1 is inserteding the expected data in the table
SP2 is cleaning up the sending queue.

In the Sql Server log however i'm getting errors on both of the stored procs.
error #1
The activated proc <SP 1 Name> running on queue Applications.dbo.ffreceiverQueue output the following: 'The conversation handle is missing. Specify a conversation handle.'

error #2
The activated proc <SP 2 Name> running on queue ADAPT_APP.dbo.ffsenderQueue output the following: 'The conversation handle is missing. Specify a conversation handle.'

I would appreceiate anybody's help into why i'm getting this. have i set up the stored procs in correctly?

i can provide code of the stored procs if that helps.

thanks.

View 10 Replies View Related

A Transport-level Error Has Occurred When Receiving Results From The Server.(provider:TCP Provider,error:0-The Handle Is Invalid

Jan 24, 2007

Hi,



I am using SQL Server 2005,



while trying to retrieve data from the database; I am getting the following
error:



A transport-level error has occurred when receiving results
from the server. (Provider: TCP Provider, error: 0 - The handle is invalid.)



But I am getting this error randomly.







Can some one help me out?
Waiting for your response



Sudhakar

View 7 Replies View Related

A Transport-level Error Has Occurred When Receiving Results From The Server. (provider: TCP Provider, Error: 0 - The Handle Is I

Mar 8, 2007

Hi,

Basically the error that I am getting is in our test automation when running as non-admin on the box (regular user). We use .Net C# SQLConnection class to connect to SQL express 2005 impersonating with admin credentials. After getting the connection we try to execute a select command and it some time fails with following error:
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The handle is invalid.) at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32 bytesExpected) at System.Data.SqlClient.TdsParserStateObject.ReadBuffer() at System.Data.SqlClient.TdsParserStateObject.ReadByte() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader()

This happen only in the non-admin scenario mentioned above. Any idea what is triggering this?

Thanks in advance for all replies.

View 3 Replies View Related

Trap The Sql Errors Raised By Sql Server In Asp.net

Dec 8, 2006

hi i am running a stored procedure and i want to trap the error of that stored procedure and pass it on the user in the asp.net prog.
 
my stored procedure are running thru a class library using C#. i tried various options of creating a new sql connnection with out using the classlibrary, but i dont get any errors. the code s
used is as follows Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("dbconnection1"))

Dim cmd As New SqlCommand("usp_ImportPlanDetails", conn)

cmd.CommandType = CommandType.StoredProcedure'cmd.Parameters.AddWithValue("@ClientId", Session("ClientId"))

AddHandler conn.InfoMessage, New SqlInfoMessageEventHandler(AddressOf MessageEventHandler)

conn.Close()





Private Sub MessageEventHandler(ByVal sender As System.Object, ByVal e As SqlInfoMessageEventArgs)

Dim strMessage As String

For Each sqle As SqlError In e.Errors

strMessage = "Message:" + sqle.Message + "Number:" + sqle.Number + "Procedure:" + sqle.Procedure + "Server:" + sqle.Server + "Source:" + sqle.Source + "State:" + sqle.State + "Line Number:" + sqle.LineNumber

' strMessage = String.Format("Message: {1}, Number: {2}, Procedure: {3}, Server: {4}, Source: {5}, State: {6}, Line Number: {7}" , new Object[]{sqle.Message, sqle.Number, sqle.Server, sqle.Source, sqle.State, sqle.LineNumber})

'Console.WriteLine(strMessage)

lblErrorMsg.Visible = True

lblErrorMsg.Text = strMessage

and also tried doing this  oImportPlan = New ImportPlan(System.Configuration.ConfigurationManager.AppSettings(APPSETTINGS_CONNECTION))


With oImportPlan
Try
.ClientID = Session("ClientId")
' .FileName = strFilePath1
.save()
Catch sqlex1 As SqlException
LogException(sqlex1)
End Try

End With
Catch sqlex As SqlException
LogException(sqlex)
End Try
Catch ex As Exception
lblErrorMsg.Text = "Error: Import Failed" + ex.Message
lblErrorMsg.Visible = True

End Try  but have no luck in displaying the errors, My stored procedure has raiseerrors, Please help me out 

View 2 Replies View Related

Can Msdb From SQL2K Personal Edition Be Restored On SQL2K Standard?

Oct 12, 2007

The company for which I work did not have a DBA until I started a few weeks ago. Whoever installed SQL2K used the wrong CD so they have been running Personal Edition on their servers. I have installed a new SQL2K standard instance and have restored everything except the jobs and DTS packages. Can the msdb from the Personal edition be restored to the standard instance?

View 3 Replies View Related

Downgrade SQL2K Enterprise To SQL2K Standard

Mar 15, 2007

Is it possible to downgrade SQL from Enterprise to Standard Edition, or do you have to remove the previous installation (uninstall) and reinstall. Meaning you would also have to restore all user databases? Thanks.

View 1 Replies View Related

How To Trap The Results Of Constraints In SQL Server 2005from Visual Studio C# Code?

Jul 2, 2007

Hi all,
Suppose I have set a CHECK constraint to a column where Salary field is not permitted to be less than 1000 or greater than 10000.
In this situation, when I insert a new record with salary as 10, using a stored procedure from Visual Studio, how will I trap the error from C# Code?
Thanks
Tomy

View 2 Replies View Related

Linked Server Authentication Error - [SQLSTATE 42000] (Error 7303)

May 5, 2008

Hi Guys:

Our company wanted to try out SQL Server 2005 Enterprise Edition (64 Bit). So, we were on free trial of the Enterprise Edition for past 5 months. After which we decided to go for SQL SERVER 2005 Standard Edition (64 Bit). And, Last week, we installed the SQL Server Standard Edition (64 Bit) on our server. After installation, everything was restored as before.



The version we are on right now is:

Microsoft SQL Server 2005 - 9.00.3054.00 (X64) Mar 23 2007 18:41:50 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)



Strangely, a job which ran fine till then is failing with the following error: And, to be more specific, when this job is run manually in the form of a stored procedure using the query optimizer it runs fine. But, when its executed as a scheduled job on SQL Agent, it fails. The History logs record the following error.

Error :

The OLE DB provider "SQLNCLI" for linked server "LV-SQL2" reported an error. Authentication failed. [SQLSTATE 42000] (Error 7399) Cannot initialize the data source object of OLE DB provider "SQLNCLI" for linked server "LV-SQL2". [SQLSTATE 42000] (Error 7303) OLE DB provider "SQLNCLI" for linked server "LV-SQL2" returned message "Invalid authorization specification". [SQLSTATE 01000] (Error 7412).



I tried everything possible, even recreated the job, but, no avail.



I also considered the possibility if SQL Agent login account did not have enough permissions. So, I changed the SQL Agent login to windows authentication, but the job still fails. So, its the problem has nothing to do with login accounts either.



For the record, I have cross checked all these too.

1. Enabled the remote connections in Surface Area Config

2. Added local server login to remote server login mappings.

3. Checked 'Rpc' and 'Rpc Out' under server options. Also, the Connection Timeout and Query Timeout have been set to zero (0).



Any suggestions pointing towards problem solution appreciated.



Thank you.

View 4 Replies View Related

Linked Servers Error Microsoft SQL Server, Error: 7411

Mar 2, 2007

1. Replication Transactional between two servers

-- SQL Server 2005 as Distributors and Subscribers

---SQL Server 2000 as Publishers

2. Linked Servers errors:

" Server (Publication Server) is not configured for DATA ACCESS. (Microsoft SQL Server, Error: 7411)"

Did anyone familiar with this problem?

Thankssss

TJ_1

View 4 Replies View Related

MSSearch Gatherer Error: C0000005 On SQL2K SP3

Mar 10, 2004

Please, help me to troubleshoot MSSearch Gatherer error.
I am running SQL2k SP3 on Windows 2k DC and trying to setup full-text index using Enterprise Manager Console, everything goes fine until I am trying to start full population.

In the eventlog I got the following errors:

Event Source:Microsoft Search
Event Category:Gatherer
Event ID:3035
Description:
One or more warnings or errors for Gatherer project <SQLServer SQL0000900005> were logged to file <d:sqldataFTDataSQLServerGatherLogsSQL00009000 05.1.gthr>. If you are interested in these messages, please, look at the file using the gatherer log query object (gthrlog.vbs, log viewer web page).

Event Source:Microsoft Search
Event Category:Gatherer
Event ID:3036
Description:
The crawl seed <MSSQL75://SQLServer/78bedcc2> in project <SQLServer SQL0000900005> cannot be accessed. Error: c0000005 - A description for this error could not be found.

After that process I got ItemCount -2
using SELECT fulltextcatalogproperty('TestCatalog', 'ItemCount')

Services (SQL and MSSearch) running under LocalSystem Account and have correct BUILTINAdministrators with all privileges.

Any idea?

View 2 Replies View Related

How Can I Handle An Error

Apr 1, 2007

Is it possible to catch and error and then keep the process going in a stored procedure?
So if an update encounters a primary key violation on a row, is it possible to skip that row and keep the process going?

View 4 Replies View Related

How To Handle Particular Sql Error

Oct 21, 2007

Hi! I have some try .. catch block trying to insert some data into database. During its action duplicate key row insert error could raise, for example. The question is how could I know distinguish it from other sql errors? Object ex (Catch ex As Exception) has only message property '{"Cannot insert duplicate key row in object 'dbo.Group_Courses' with unique index 'IX_Group_Courses'.The statement has been terminated."}' and type System.Data.SqlClient.SqlException. Knowing the type of error is not enough, because there are different SqlExceptions. Even the message is not unique for this error, because now i deal with 'dbo.Group_Courses'  and then it could be other table. Is there something that unique identifies each error? For example error code. If it exists, where could I get it?
Thanks in  advance!
 

View 2 Replies View Related

Handle Error In T-sql

Jan 13, 2006

Hi,
I would like to handle a sql error in t-sql and return a certain value in case error occurs. For example if I would like to add a record I want to return a certain identity value or maybe a status of transaction (0 for incomplete, 1 for succesfull trans).
If error occurs in sql I cannot return any values back to asp.net because of  What I am doing at the moment is catching an error in asp.net and then displaying an error message. Is there a way to return only a return value to asp.net and somehow handle the error in t-sql?
Thanks

View 1 Replies View Related

SQL2K - Converting Data Type Varchar To Numeric Error

Feb 3, 2005

I have always programmed my ASP pages with MS Access DB's and we recently got a SQL Server 2000. So, I'm totally new to SQL Server 2000.
I trying to retrieve data from a table in SQL, based on values from two input fields (text fields) on a form in the web page.

To process the form, I am using the following syntax:

Set oRs = oConn.Execute("SELECT BBILNAM, BTWP, BTXP, BPARCEL, BBILADD, BBILCTYST, BBILZIP5 FROM TESTdb WHERE BTWP = 'TWP' AND BPARCEL = 'PARCEL'")

SQL Fields in Table TESTdb are (BTWP = numeric field) and (BPARCEL = text field)

I realize that the problem is that I'm comparing a numeric field in my table, to a text field from my form, but don't know how to convert the text field to a numeric field, prior to the execution of the select statement. I'm hoping someone can point me in the right direction. Thanks!

View 2 Replies View Related

How To Handle Error Msg 8114

May 6, 2008

Hi,

How to capture the Error Msg 8114 in sql server 2000.

Below is the sample code i have used.


CREATE TABLE Test
(
Column1 int IDENTITY,
Column2 int NOT NULL
)



USE tempdb
go
ALTER PROCEDURE CHK_INSERT
@Column2 int
AS
DECLARE @ExecQuery nVARCHAR(4000)
set @ExecQuery='INSERT test VALUES ('+cast(@Column2 as varchar)+')'
EXEC (@ExecQuery)
IF @@ERROR <>0
BEGIN
PRINT 'Error Occured'
END


EXEC CHK_INSERT Test


Regs,
priya

View 9 Replies View Related

Handle Error Question

Mar 13, 2006

I have the next sp:

CREATE PROCEDURE SP_SALDO
(
@strDatos char(50)
)

AS


declare @ID char(20)
declare @Montodecimal(9,2)
declare @SaldoActualdecimal(9,2)
DECLARE @TipMov tinyint
declare @Fechachar(11)
declare @Horachar(10)
declare @Tiendatinyint
declare @NoCajatinyint
declare @SaldoNuevo decimal(9,2)
declare @NoAutoint
DECLARE @NomEmp char(40)
DECLARE @Trans_Num numeric

set nocount on

--SET @strDatos='T23C02001000000000000000000020025047'

SET @ID= SUBSTRING(@strDatos , 10, 20 )
set @Monto= cast(SUBSTRING(@strDatos , 30, 7 ) as decimal(9,2))/100
set @TipMov= cast(SUBSTRING(@strDatos , 7, 3 ) as int)
set @Tienda= cast(SUBSTRING(@strDatos , 2, 2 ) as int)
set @NoCaja= cast(SUBSTRING(@strDatos , 5, 2 ) as int)
set @Fecha = convert(char(11), getdate(), 101)
set @Hora= CONVERT(VARCHAR,getdate(),108)
set @NoAuto=ABS(CHECKSUM(NewID())) % 100000 + 1


--Se guarda el monto Actual y el nombre en variables
SElect @SaldoActual = SALDO, @NomEmp = NOM_EMP, @Trans_Num=last_trans_num +1
FROM TBSALDOS
WHERE ID=@ID
--select @SaldoActual,@ID,@Monto,@TipMov,@Tienda, @NoCaja, @Fecha, @Hora,@NoAuto

if (@Monto<=@SaldoActual)
begin
set @SaldoNuevo=@SaldoActual-@Monto

insert TBMOVIMIENTOS
values(@trans_num,@ID,@TipMov,GETDATE(),@hora,@Tienda,@NoCaja,@SaldoActual,@Monto,@NoAuto)

Update TBSALDOS
SET SALDO=@SaldoNuevo, SALDO_ULT_MOV=@Monto,
DT_ULT_MOV=GETDATE(), HR_ULT_MOV=@Hora,
NO_TIE_ULT_MOV=@Tienda, NO_CAJA_ULT_MOV=@NoCaja,
last_trans_num=@Trans_Num
WHERE ID=@ID

SELECT 'OK'+ SUBSTRING(@strDatos , 1, 6 )+@id
+RIGHT(REPLICATE('0',7) + CAST(cast(@SaldoNuevo*100 as int) as varchar(10)) ,7)
+ RIGHT(REPLICATE(' ',40) +@NomEmp ,40)
+ + RIGHT(REPLICATE('0',6) + CAST(cast(@NoAuto as int) as varchar(10)) ,6) as resp
end
else
begin
SELECT 'NO'+ SUBSTRING(@strDatos , 1, 6 )+@id
+RIGHT(REPLICATE('0',7) + CAST(cast(@SaldoActual*100 as int) as varchar(10)) ,7)
+ RIGHT(REPLICATE(' ',40) +@NomEmp ,40)
+ '000000' as resp
end
GO

How can I add a handle error?

What I need to do is if you can not do the insert and the update returns :

SELECT 'NO'+ SUBSTRING(@strDatos , 1, 6 )+@id
+RIGHT(REPLICATE('0',7) + CAST(cast(@SaldoActual*100 as int) as varchar(10)) ,7)
+ RIGHT(REPLICATE(' ',40) +@NomEmp ,40)
+ '000000' as resp
end

View 6 Replies View Related

SQL2K/Log Reader Fails With Error 9003 The LSN Passed To Log Scan Is Invalid

Aug 8, 2007

Hi All,
We have transactional replication between two SQL Server 2000, SP4 and database is in simple recovery.
Occassionally Logreader agent fails with error 9003 (The LSN (164051:119090:22) passed to log scan in database 'ReportDB' is
invalid).
But in April 2007 this error has occurred multiple times. We have opened the case with PSS in April 2007 but till now there
is no concrete solution.

Error details in ErrorLog:
2007-04-24 16:49:09.79 spid59 Error: 9003, Severity: 20, State: 1
2007-04-24 16:49:09.79 spid59 The LSN (164051:119090:22) passed to log scan in database 'ReportDB' is invalid..
Error details in Log reader agent:
Repl Agent Status: 3
Publisher: {call sp_repldone ( 0x000280d30001d1320016, 0x000280d30001d1320016, 0, 0)}
Publisher: {call sp_replcmds (100, 0)}
Status: 0, code: 0, text: 'The process could not execute 'sp_replcmds' on 'BR14D135R17'.'.
The process could not execute 'sp_replcmds' on 'BR14D135R17'.
Repl Agent Status: 6
Status: 0, code: 9003, text: 'The LSN (164051:119090:22) passed to log scan in database 'ReportDB' is invalid.'.

From above error details it can be seen that sp_repldone is already called for LSN 164051:119090:22 (0x000280d30001d1320016)
which means it is distributed.
Since LSN is distributed, transaction log of publisher for that LSN can be truncated by checkpoint process. And afterward if
logreader issues sp_replcmds for that LSN, we will get 9003 error.
So, question is why Logreader is looking for LSN if that is already distributed.
When checked "DBCC Opentran", it also reflect oldest distributed LSN as 164051:119090:22.

We tried changing the recovery model to FULL but that has only delayed the occurrence.
Once we have noticed that LSN mentioned in Error 9003 was already backed up one day before. And we don't think replication latency to be more than 3 hrs
(maximum).

After PSS recommendation, we have applied the hotfix 2187 but error has occurred again after one month.
Other recommendation is to disable read cache of hardware controller to avoid stale read(that we are working on). Current
setting is 100% read and 0% Write.

Other Details:
SQL Server 2000 Enterprise Edition SP4 with Hotfix 2187
Window 2000 Advanced Server.
RAID 5 with array controller as HP Smart Array 641 Controller

Please let me know if you have faced such issue and have any idea on this problem.

Thanks,
Ramesh

View 3 Replies View Related

Linked Server Error

Mar 8, 2001

could someone please explain the following error msg! the code seg that is gen the error is as follows, followed by the err msg. I"m trying to update a table on a linked server (paeddb1.gold). both servers are running MS SQL7

update paeddb1.gold.dbo.controls_peg
set amt = t.amt
from #temp_peg_control t, paeddb1.gold.dbo.controls_peg p
where t.peg = p.peg
and t.cntl_type = p.cntl_type
and t.fy = p.fy


Could not open table '"gold"."dbo"."controls_peg"' from OLE DB provider 'SQLOLEDB'. The provider could not support a row lookup position. The provider indicates that conflicts occurred with other properties or requirements.
[OLE/DB provider returned message: Errors occurred]

View 2 Replies View Related

Error With Linked Server

Sep 19, 2005

I have a "linked server" configured in my SQL Server 2000 (SP4) server, which used to work correctly. However, I had to reinstall SQL Server (I backed up and restored the master/model/etc databases, so all my settings stayed the same). Since then, I've been getting this error when I try to use the linked server:
Invalid schema or catalog specified for provider 'MSDASQL'.
OLE DB error trace [Non-interface error: Invalid schema or catalog specified for the provider.].

The linked server is a FoxPro database, which does not use catalog or schema names. So, my select syntax looks like this:
SELECT * FROM Server...Table

SQL Server is aparently expecting something like this:
SELECT * FROM Server.Catalog.Schema.Table

Does anyone know how I can fix it so that it allows the "empty dot" method to work like it used to?'

Thanks!
Josh

View 9 Replies View Related

Linked Server Error !!!

Apr 10, 2008

Hi Pals,

We have an SSIS package within which we are calling a stored procedure which eventually call a sql server dbo.fn() which contains code to lookup data inside oracle using Linked Server for Oracle.

We are calling the Package dynamically from the stored procedure by creating a SQL Server Agent Job, I am getting the below error very often. Can we fix the error in any way?


“EXEC sp_UpdateTname 369,'939390',2008 " failed with the following error: "Cannot initialize the data source object of OLE DB provider "MSDAORA" for linked server "ORATEST".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


When I hard code global variables and ran the package I am able to see the successful execution of the package.

Can anybody point out where could the error lies?

View 1 Replies View Related

Linked Server Error

Feb 20, 2008

I got the following error when using linked server:


OLE DB provider "SQLNCLI" for linked server "SACPANRPT" returned message "Cannot start more transactions on this session.".
Msg 7395, Level 16, State 2, Line 1
Unable to start a nested transaction for OLE DB provider "SQLNCLI" for linked server "SACPANRPT". A nested transaction was required because the XACT_ABORT option was set to OFF.

View 1 Replies View Related

Error With Linked Server

Jul 20, 2005

Hiwhen i try to run a query using linked servers, i get the followingerror.Server: Msg 125, Level 15, State 1, Line 1Case expressions may only be nested to level 10.I do have more than 10 case statements, it works fine when it is lessthan 10. can anyone tell me if there is a way to have more than 10case statements. thanks alot.Jaymy querySelect category, val, Sum(QTY) As QTY , yrFrom(Select val, QTY2 As QTY,KEEP = CaseWhen code = '004' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '005' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '003' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '017' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '007' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '008' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '009' And ((YR > 2003) Or (YR = 2003 And MON > 11))Then 'N'When CODE = '010' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '038' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '032' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '030' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'When CODE = '018' And ((YR > 2003) Or (YR = 2003 And MON > 12))Then 'N'Else 'Y' EndFromamf a Join linkedserver.source.dbo.table2 b On a.COM = b.COMWhere CATEGORY In ('1') And CODE In ('001','003','004','005')And b.YR Between 2003 And 2004 And b.MON <= 1) xWhere KEEP = 'Y'Group By CATEGORY, YR

View 2 Replies View Related







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