USE Product__Work
GO
--  SELECT name, ROW_NUMBER() OVER(ORDER BY name) AS TblNr FROM sys.tables WHERE name LIKE 'DocumedisCache%' ORDER BY Name

-- create PK
ALTER TABLE dbo.<tableName, sysname, TBL>
	ADD CONSTRAINT PK_<tableName, sysname, TBL> PRIMARY KEY CLUSTERED 
		( ASC) ON [DATA]
GO

-- define update trigger
CREATE TRIGGER ut_<tableName, sysname, TBL> ON dbo.<tableName, sysname, TBL> AFTER UPDATE
AS
  BEGIN
	UPDATE dbo.<tableName, sysname, TBL>
	SET Db_UpdDt = GETDATE(),
		Db_UpdUser = RIGHT(SUSER_SNAME(), 50)
	FROM inserted i
	WHERE <tableName, sysname, TBL>.IdPk = i.IdPk
	  AND
  END
GO


