CREATE TABLE [dbo].[ATSearch] (
    [SearchId]               INT              NOT NULL,
    [Name]                   NVARCHAR (255)   NOT NULL,
    [Description]            NVARCHAR (255)   NULL,
    [Type]                   INT              NULL,
    [Owner]                  NVARCHAR (255)   NULL,
    [LastRun]                DATETIME         NULL,
    [SQLString]              NVARCHAR (1024)  NULL,
    [PublicSearch]           TINYINT          NULL,
    [SortField]              NVARCHAR (50)    NULL,
    [SortDirection]          INT              NULL,
    [ObjectId]               UNIQUEIDENTIFIER NULL,
    [SearchRegistrationGuid] UNIQUEIDENTIFIER NULL,
    CONSTRAINT [PK_ATSearch] PRIMARY KEY NONCLUSTERED ([SearchId] ASC),
    CONSTRAINT [ATSearch_FK1] FOREIGN KEY ([SearchRegistrationGuid]) REFERENCES [dbo].[ATSearchRegistration] ([ObjectGuid])
);

