Ciao a tutti, partendo da una tabella
codice:CREATE TABLE [dbo].[Agenzie]( [id] [int] IDENTITY(1,1) NOT NULL, [id_TBL_States] [int] NOT NULL, CONSTRAINT [PK_Agenzie] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
vorrei fare in modo che dopo ogni delete vengano cancellati tutti i record nella tabella Utenti con Utenti.id_Agenzie = recordCancellato.id
codice:CREATE TABLE [dbo].[TBL_Utenti]( [id] [int] IDENTITY(1,1) NOT NULL, [id_Agenzie] [int] NOT NULL, CONSTRAINT [PK__TBL_Uten__3213E83F07020F21] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
Come dovrebbe essere questo trigger??
Grazie mille

Rispondi quotando