CREATE TABLE [dbo].[EmailMessage]
(
[EmailMessageID] [int] NOT NULL IDENTITY(1, 1),
[UserID] [int] NOT NULL,
[OrderID] [int] NULL,
[ToAddress] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Subject] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Body] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Attachments] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DisableBcc] [bit] NOT NULL CONSTRAINT [DF_EmailMessage_DisableBcc] DEFAULT ((0)),
[ThrowExceptions] [bit] NOT NULL CONSTRAINT [DF_EmailMessage_ThrowExceptions] DEFAULT ((0)),
[DateQueuedUtc] [datetime] NOT NULL CONSTRAINT [DF_EmailMessage_DateQueued] DEFAULT (getutcdate()),
[SendSilently] [bit] NOT NULL CONSTRAINT [DF_EmailMessage_SendSilently] DEFAULT ((0)),
[SendException] [varchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[EmailMessage] ADD CONSTRAINT [PK_EmailMessage] PRIMARY KEY CLUSTERED ([EmailMessageID]) ON [PRIMARY]
GO
GRANT SELECT ON [dbo].[EmailMessage] TO [MssExec]
GRANT INSERT ON [dbo].[EmailMessage] TO [MssExec]
GRANT DELETE ON [dbo].[EmailMessage] TO [MssExec]
GRANT UPDATE ON [dbo].[EmailMessage] TO [MssExec]
GO