PRINT N'Creating [dbo].[WasteDisposalServiceProvider_template]...';

GO
CREATE TABLE [dbo].[WasteDisposalServiceProvider_template] (
    [Id]                   UNIQUEIDENTIFIER NOT NULL,
    [WasteDisposalServiceProviderName]      NVARCHAR (100)    NULL,
	[Remark]								NVARCHAR (256)	  NULL,
    [Created]              DATETIME         NULL DEFAULT CURRENT_TIMESTAMP,
    [Changed]              DATETIME         NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO

CREATE TRIGGER WasteDisposalServiceProvider_template_Trigger_Change_Log
ON
	dbo.WasteDisposalServiceProvider_template
	FOR UPDATE
	AS
		SET NOCOUNT ON
		IF NOT UPDATE([Changed])
		UPDATE WasteDisposalServiceProvider_template SET [Changed] = GETDATE() WHERE Id IN (SELECT Id FROM [inserted])
		
GO