Category Archives: MS SQL

A sample MS SQL table with datetime2 and datetimeoffset

A sample MS SQL table with columns of type datetime2 and datetimeoffset can be created as follows:

CREATE TABLE [dbo].[Test](
	[Id] [int] NOT NULL,
	[Name] [nvarchar](50) NULL,
	[Dt] datetime2(7),
	[Ts] datetimeoffset(7)
CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED ([Id] ASC))
(more…)