Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Assigning values to a column with a UDF
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
00886693
Message ID:
00886709
Views:
14
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
Map
View

Click here to load this message in the networking platform