Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
SQL Server 2000/2005/2008, Express, Access, MySQL, Oracle
Prelevare il penultimo o triultimo errore SQL SERVER
mercoledì 07 settembre 2011 - 18.50
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
Elenco Tags
SQL Server 2008 R2
|
SQL Server 2008
|
SQL Server 2005
|
SQL Server 2000
|
SQL Server Express
|
MSDE
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 7 set 2011 - 18:50
Buona sera a tutti, sto cercando di prelevare l'errore precedente per inserire nel LOG
IF @ErrorVar <> 0
BEGIN
IF @ErrorVar = 2715
BEGIN
SET @esito = @istruzione
END
ELSE
IF @ErrorVar = 547
BEGIN
SET @esito = 'Conflitto del PK e FK'
END
ELSE
IF @ErrorVar = 1750
BEGIN
SET @esito = 'Verificare se le due colonne hanno gli stessi tipi dati'
END
ELSE
IF @ErrorVar = 1778
BEGIN
SET @esito = 'Uno delle due colonne non è valido'
END
ELSE
BEGIN
SET @esito = N'ERROR: error '
+ RTRIM(CAST(@ErrorVar AS NVARCHAR(10)))
+ N' occurred.'
END
end
quando ho fatto la prova facendo il FK con la colonna inesistente (errore 1778)
ma nel log mostra sempre errore 1750 (non ha potuto fare FK, vedere errore precedente)
Infatti come potrei far prelevare l'errore precedente?
Msg 1911, Level 16, State 1, Line 1
Column name 'ID2' does not exist in the target table or view.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
Perchè preleva soltanto quello 1750? come si fa a prelevare l'errore precedente?
Grazie
----
..:: GSFLASH ::..
http://www.gsflash.it
http://blogs.dotnethell.it/gabrieleserpi/
MCTS - ACP - OCP - ECDL - ACSP
Ubuntu 11.04/OpenSuse 10.3
Vista Seven/MacOSX SnowLeopard
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !