General information
Forum:
Microsoft SQL Server
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only