SQL Server – TSQL – Create Trigger that calculates name of day from date

Nothing earth shattering but really quite useful and often ubiquitious as a requirement I find it useful to have days of the week in tables sometimes and in most tables I will always have default fields of updated and created. I can then use the created field to drive a dayname

[daysname]  AS (datename(weekday,[T001TimeLog].[created]

And here it is as part of a table’s creation

CREATE TABLE [dbo].[T001TimeLog](
	[pkid] [int] IDENTITY(1,1) NOT NULL,
	[TimeEstimate] [time](7) NULL,
	[Description] [nvarchar](max) NULL,
	[updated] [date] NULL,
	[created] [date] NULL,
	[daysname]  AS (datename(weekday,[T001TimeLog].[created]))

And here is the field value on screen and through a User Interface