You are here: Re: Error handling when calling external sql-Files « MsSQL Server « IT news, forums, messages
Re: Error handling when calling external sql-Files

Posted by John Bell on 10/08/05 16:37

Hi

You may want to try using EXEC for your select statement

declare @errorcode int
EXEC ('select * from abc')
SET @errorcode = @@error
--writing log
insert adaten.dbo.loghist(logdatum,loginfo,logfehler,saetze)
values (getdate(),'test',@errorcode,25)

John

<lvpaul@gmx.net> wrote in message
news:1128491173.083475.231000@o13g2000cwo.googlegroups.com...
Thanks, but it doesn΄t work

This is my script - its a file c:\test.sql

declare @errorcode int
select * from abc
SET @errorcode = @@error
--writing log
insert adaten.dbo.loghist(logdatum,loginfo,logfehler,saetze)
values (getdate(),'test',@errorcode,25)

The table "abc" don΄t exist.

If I call the script

osql /E /n /ic:\test.sql (with or without /b) the insert anweisung
instruction won΄t be executed.

I want something like ON ERROR RESUME NEXT. Is this possible ?

Thanks
aaapaul

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация