Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 SQL Server Stored Procedure and Linked Servers

Author  Topic 

dayve
Starting Member

3 Posts

Posted - 2006-03-20 : 20:12:58
Did a search of the SQL Teams forum and did not find an absolute answer to what I am suspecting, but can someone confirm whether or not error trapping is possible when querying data from a linked server? I created a Stored Procedure that does a nightly snapshot from another database system that is known to allow bad dates from time to time. I can't check every single table for every single date field as that would be more labor intensive than fixing the data when an error occurs. I keep receiving the following error, but for some reason the trap does not work. This same procedure works with a non-linked server (native table select).

Any input would be greatly appreciated.

Server: Msg 8114, Level 16, State 10, Procedure importMLS, Line 6
Error converting data type DBTYPE_DBDATE to datetime.


CREATE PROCEDURE importMLS AS

BEGIN TRAN
DROP TABLE s8_mast;
SELECT * INTO s8_mast FROM OPENQUERY(MLS_S8, 'SELECT * FROM s8_mast');
IF (@@ERROR <> 0) GOTO ERR_HANDLER
COMMIT TRAN
RETURN 0

ERR_HANDLER:
PRINT 'Unexpected error occurred!'
ROLLBACK TRAN
RETURN 1

GO

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-03-21 : 08:31:52
What is the linked server? Is it SQL Server? if so, use the 4 part naming convention instead..

linkedserver.database.owner.object
Go to Top of Page

dayve
Starting Member

3 Posts

Posted - 2006-03-21 : 11:11:16
The source database is DataFlex and I am using the ODBC driver from Connx.

The error occurs if there is bad dates in the tables, which also bombs out in Query Analyzer. I'm not sure how the 4 part naming convention would come into play.
Go to Top of Page

dayve
Starting Member

3 Posts

Posted - 2006-03-26 : 14:00:21
I hate bumping topics, but is there anyway I can get some kind of confirmation as to if error trapping does not work with linked servers?
Go to Top of Page
   

- Advertisement -