I have a question for you guys. I have a table in a SQL DB, and ‘something’ is writing in this table, but I don’t know which control or scripts . I’ve looking for some ‘INSERT INTO’ statements but I can’t find anything.
I even wonder if some external process is writing in the table, but I don’t know how to track it.
Is there any chance you have a stored procedure you are calling from Ignition that writes to the table? You wouldn’t find either INSERT or the table name in the project if there is an indirect path in the database.
Thank you. I also search for the table name, and looking for in different projects.
I will be some kind of crazy because this table writes null data, and I don’t know why…
Sure, it’s about 200 lines, but I can share the main parts:
USE [myDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[machine_Culls](@fecha_ini DATETIME, @fecha_fin DATETIME)
RETURNS @culls TABLE
(Fecha DATETIME, Turno INT, Variables VARCHAR(15), Nombre NVARCHAR(80), Componente NVARCHAR(50), Valor BIGINT)
AS
BEGIN
DECLARE @tabla TABLE (Fecha DATETIME, Turno INT, Variables VARCHAR(15), Valor INT)
INSERT INTO @tabla
SELECT Fecha, Turno, Variables, MAX(Clase) as Valor
FROM ( SELECT
CONVERT(VARCHAR(10),t_stamp,120) as Fecha, turno,
lot_of_variables_here
FROM
some_table_here
) AS Source_table
UNPIVOT( Clase
for Variables in (lot_of_variables_here)
) AS un_pvt
GROUP BY Fecha, Turno, variables
INSERT INTO @culls
SELECT Fecha, Turno, Variables
CASE Variables
WHEN 'some_string' THEN 'other_string'
-- a lot of cases here
END AS Nombre,
CASE Variables
WHEN 'some_string' THEN 'some_class'
END AS Componente,
Valor
FROM @tabla
RETURN
END
But well, exists another function that writes in the table. It was inside a trigger and (not programmed by me). The function that I wrote was a -temporal solution- for my problem until I knew about the trigger.