Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Thanks Sergey...
GetQuartID is the function used to populate que QuartID column. It needs an argument that is coming from another column of the inserted row.
I was trying to see if I could to that simply with the default attribute of a column.
If I take the Trigger approach, I guess I need to have an INSTEAD OF INSERT type of trigger.
Something like:
CREATE TRIGGER TR_TRANSACTION_INSERT ON [dbo].[Transaction]
INSTEAD OF INSERT, UPDATE
AS
BEGIN
declare @quart int
SET @quart = dbo.GetQuartID(inserted.DH_Creation)
INSERT INTO [Transaction] (DH_Creation, QuartID) values (inserted.DH_Creation,@quart)
END
=====================
But I get:
DH_Creation is not permitted in this context
Thanks again
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement