PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → MS SQL Triggers question from a beginner
MS SQL Triggers question from a beginner
Started by Antonio Díaz, Feb., 26 2024 10:29 PM - 1 reply
Registered member
71 messages
Posted on February, 26 2024 - 10:29 PM
Hi guys,

For those of you who know Clarion, I come from many years of using it. I've used Triggers (on the server side) all the time but I have problems with WINDEV. I always get an error (huge content error) saying that too many rows are affected by the update.

The thing is I always get that error when the db tries to run a trigger to update certaing tables. The same trigger that runs using my clarion app, does not run using my windev app. Is there something I should take into account? I've looked for information but haven't found anything.

I thank you for your help.

--

Antonio Diaz
Emphasys Software, S.C.
Posted on October, 14 2024 - 12:41 AM
Antonio Díaz wrote:
Hi guys,

For those of you who know Clarion, I come from many years of using it. I've used Triggers (on the server side) all the time but I have problems with WINDEV. I always get an error (huge content error) saying that too many rows are affected by the update.

The thing is I always get that error when the db tries to run a trigger to update certaing tables. The same trigger that runs using my clarion app, does not run using my windev app. Is there something I should take into account? I've looked for information but haven't found anything.

I thank you for your help.

--

Antonio Diaz
Emphasys Software, S.C.



Hi antonio
i have been using windev with Sqlserver since version 20 with few problems

see below the way i use triggers in MSsql server

USE [Teste]
GO
/****** Object: Trigger [dbo].[LogLocal] Script Date: 10/13/2024 19:37:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[LogLocal] ON [dbo].[local]
FOR UPDATE ,DELETE

AS
Declare @USERDEC char(10), @USERNT CHAR(30)
SELECT
@USERDEC = convert(varchar(10),context_info),
@USERNT = SUBSTRING(host_name + '\' + login_name, 1,40)
FROM sys.dm_exec_sessions
WHERE session_id = @@SPID

Insert Log.dbo.LogLocal

Select 'U',
Getdate() ,
@USERDEC ,
@USERNT,
d.* from Deleted as D
inner join inserted as I on
I.Loc_codigo = D.Loc_codigo

UNION ALL
Select 'D',
Getdate(),
@USERDEC ,
@USERNT,
d.* from Deleted as D
left join inserted as I on
I.Loc_codigo = D.Loc_codigo
where I.Loc_codigo is NULL