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
Problema Generatore Script per Sql Server 2000
mercoledì 18 maggio 2011 - 14.48
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 14:48
Ciao a tutti, da un pò che sto cercando di generare il database in versione sql 2000 perchè alcuni clienti hanno il server 2000.
quando avevo fatto la generazione in sql server 2008 R2 e non ci sono stati problemi.
invece in Sql Server 2000, ci sono stati dei problemi del SetNULL.
L'errore che è venuto è
Cannot execute this operation while the property DeleteAction is set to
'SetNull'.
Ho fatto dei controlli e dove sarebbe questa problema?
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
lbenaglia
Profilo
| Guru
5.625
messaggi | Data Invio:
mer 18 mag 2011 - 14:52
>Cannot execute this operation while the property DeleteAction
>is set to
>'SetNull'.
>
>Ho fatto dei controlli e dove sarebbe questa problema?
Sembra che tu abbia qualche FK di DELETE/UPDATE cascade che imposta a NULL il valore. Questa funzionalità NON è disponibile su SQL Server 2000.
>Grazie
Prego.
Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 14:54
quindi dovrei modificare i FK, dovrei mettere If se trova nel sql server? che cosa mi consigli?
grazie ancora ;-)
e anche ci sono altri errori:
Microsoft.SqlServer.Management.Smo.WrongPropertyValueException: Cannot execute this operation while the property DeleteAction is set to 'SetNull'. at Microsoft.SqlServer.Management.Smo.ForeignKey.AddReferentioalAction(ScriptingOptions so, StringBuilder sb, String propertyName, String action) at Microsoft.SqlServer.Management.Smo.ForeignKey.ScriptDdlBody(ScriptingOptions so) at Microsoft.SqlServer.Management.Smo.ForeignKey.ScriptCreate(StringCollection createQuery, ScriptingOptions so) at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptCreateInternal(StringCollection query, ScriptingOptions so) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptObjectCommand.ScriptInternalWithRetry(SqlSmoObject smoObject, ScriptingOptions options, StringCollection script) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptObjectCommand.ScriptCreate(SqlSmoObject smoObject, ScriptingOptions options) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptTableCommand.ScriptCreate(SqlSmoObject smoObject, ScriptingOptions options) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptObjectCommand.ScriptSqlSmoObject(SqlSmoObject smoObject, ScriptingOptions scriptOptions) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptTableCommand.ScriptCollection(ICollection collection, ScriptingOptions scriptOptions) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptTableCommand.ScriptForeignKeys(Urn objectToScript, ScriptingOptions scriptOptions) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptTableCommand.Script(Urn objectToScript, ScriptingOptions scriptOptions) at Microsoft.SqlServer.Management.SqlScriptingEngine.ScriptProcessor.GenerateScript()
----
..:: 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
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 15:02
Ho trovato il FK relationship, ce scritto Delete Rule ---> Set Null e Update Rule ---> No Action, che dovrei fare?
Grazie ancora
----
..:: 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
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 15:10
va bene questo trigger?
http://www.visual-basic.it/articoli/fqAzioniReferenzialiConSQLServer2000.htm
----
..:: 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
lbenaglia
Profilo
| Guru
5.625
messaggi | Data Invio:
mer 18 mag 2011 - 15:13
>Ho trovato il FK relationship, ce scritto Delete Rule --->
>Set Null e Update Rule ---> No Action, che dovrei fare?
E lo chiedi a me?
Io ti dico solo che Set Null non è supportato da SQL Server 2000.
Per capire come modificare le FK devi vedere la logica delle procedure e dei client che utilizzano quel db.
>Grazie ancora
Prego.
Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 15:17
ho risolto, ho fatto in questo modo:
nel script, metto IF quando riconosce sql server 2000, fa il trigger, altrimenti fa come di solito.
;-)
E invec altri errori che sarebbero?
----
..:: 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
lbenaglia
Profilo
| Guru
5.625
messaggi | Data Invio:
mer 18 mag 2011 - 15:19
>ho risolto, ho fatto in questo modo:
>
>nel script, metto IF quando riconosce sql server 2000, fa il
>trigger, altrimenti fa come di solito.
>;-)
Non ho letto l'articolo, ma sicuro che la logica implementata nel trigger sia paragonabile ad una FK SET NULL?
>E invec altri errori che sarebbero?
Quali altri errori?
Da quello che hai postato l'errore è solo 1: Microsoft.SqlServer.Management.Smo.WrongPropertyValueException: Cannot execute this operation while the property DeleteAction is set to 'SetNull'
Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 15:25
si, ha funzionato quando fa il delete e lo mette null.
poi la lista dell'errore è quello dopo che mi hai risposto il primo messaggio.
----
..:: 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
lbenaglia
Profilo
| Guru
5.625
messaggi | Data Invio:
mer 18 mag 2011 - 15:26
>si, ha funzionato quando fa il delete e lo mette null.
OK.
>poi la lista dell'errore è quello dopo che mi hai risposto il
>primo messaggio.
Quello è lo stack. L'errore è solo il primo e che hai risolto con quel trigger.
Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
mer 18 mag 2011 - 18:39
PARDON MUCHO.
a parte che ha funzionato con il trigger. ma con IF se la versione è del 2000, trovo in difficoltà.
DECLARE @CHECK_VERSION NVARCHAR(3)
SET @CHECK_VERSION = 'IF LEFT(CAST(SERVERPROPERTY(''ProductVersion'') As Varchar),1)=''8'''
IF @CHECK_VERSION IS NOT NULL
ALTER TRIGGER [DOCSPADM].tr_set_null_dpa_dispositivi_stampa ON [DOCSPADM].dpa_dispositivi_stampa FOR DELETE
AS
DECLARE @rows_effected int
BEGIN
IF @@ROWCOUNT=0 RETURN
UPDATE [DOCSPADM].DPA_AMMINISTRA
SET ID_DISPOSITIVO_STAMPA = NULL
WHERE ID_DISPOSITIVO_STAMPA NOT IN (SELECT DISTINCT id FROM DOCSPADM.dpa_dispositivi_stampa)
END
ELSE
ALTER TABLE [DOCSPADM].[DPA_AMMINISTRA] WITH CHECK ADD FOREIGN KEY([ID_DISPOSITIVO_STAMPA])
REFERENCES [DOCSPADM].[DPA_DISPOSITIVI_STAMPA] ([Id])
ON DELETE SET NULL
l'errore è del trigger, else e set null
----
..:: 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
gsflash80
Profilo
| Junior Member
95
messaggi | Data Invio:
gio 19 mag 2011 - 14:06
scusami, mi manca una sola cosa per IF.... 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 !