Maxxamillian
MIS
Need to set a trigger so that when a new record is inserted the max value in column flx_objid will be taken and incrememnted by one for the new record. So far no luck. Here is what I am working with.
CREATE TRIGGER FLXTrans_ObjidCount
ON FLX_Transaction
FOR INSERT
AS
DECLARE @MaxCount int, @NewCount int, @OldCount int
SELECT @MaxCount = (Select Max(flx_objid) FROM FLX_Transaction)
SELECT @NewCount = @MaxCount + 1
IF @MaxCount is NULL
BEGIN
UPDATE FLX_Transaction SET flx_objid = 1
END
ELSE
UPDATE FLX_Transaction SET flx_objid = @NewCount
FROM
GO
Thanks in advance for your suggestions.
CREATE TRIGGER FLXTrans_ObjidCount
ON FLX_Transaction
FOR INSERT
AS
DECLARE @MaxCount int, @NewCount int, @OldCount int
SELECT @MaxCount = (Select Max(flx_objid) FROM FLX_Transaction)
SELECT @NewCount = @MaxCount + 1
IF @MaxCount is NULL
BEGIN
UPDATE FLX_Transaction SET flx_objid = 1
END
ELSE
UPDATE FLX_Transaction SET flx_objid = @NewCount
FROM
GO
Thanks in advance for your suggestions.