Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning values to a column with a UDF
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Divers
Thread ID:
00886693
Message ID:
00886709
Vues:
15
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
Fil
Voir

Click here to load this message in the networking platform