text: ﻿CREATE TABLE [dbo].[SavedSearchCriteria] (
      [SavedSearchCriteriaId]  INT              IDENTITY (-1, -1) NOT FOR REPLICATION NOT NULL,
      [CandidateId]            INT              NOT NULL,
      [Name]                   NVARCHAR (50)    NOT NULL,
      [SearchType]             INT              NOT NULL,
      [CountyId]               INT              NULL,
      [Postcode]               NVARCHAR (8)     NULL,
      [Longitude]              DECIMAL (13, 10) NULL,
      [Latitude]               DECIMAL (13, 10) NULL,
      [GeocodeEasting]         INT              NULL,
      [GeocodeNorthing]        INT              NULL,
      [DistanceFromPostcode]   SMALLINT         NULL,
      [MinWages]               SMALLINT         NULL,
      [MaxWages]               SMALLINT         NULL,
      [VacancyReferenceNumber] INT              NULL,
      [Employer]               NVARCHAR (255)   NULL,
      [TrainingProvider]       NVARCHAR (255)   NULL,
      [Keywords]               NVARCHAR (100)   NULL,
      [DateSearched]           DATETIME         NULL,
      [BackgroundSearch]       BIT              CONSTRAINT [DF_SavedSearchCriteria_BackgroundSearch] DEFAULT ((0)) NOT NULL,
      [AlertSent]              BIT              CONSTRAINT [DF_SavedSearchCriteria_AlertSent] DEFAULT ((0)) NOT NULL,
      [CountBackgroundMatches] INT              NULL,
      [VacancyPostedSince]     INT              CONSTRAINT [DF_SavedSearchCriteria_VacancyPostedSince] DEFAULT ((0)) NOT NULL,
      [ApprenticeshipTypeId]   INT              NULL,
      CONSTRAINT [PK_SavedSearchCriteria] PRIMARY KEY CLUSTERED ([SavedSearchCriteriaId] ASC),
      CONSTRAINT [FK_SavedSearchCriteria_Candidate] FOREIGN KEY ([CandidateId]) REFERENCES [dbo].[Candidate] ([CandidateId]),
      CONSTRAINT [FK_SavedSearchCriteria_SavedSearchCriteriaSearchType] FOREIGN KEY ([SearchType]) REFERENCES [dbo].[SavedSearchCriteriaSearchType] ([SavedSearchCriteriaSearchTypeId]),
      CONSTRAINT [FK_SavedSearchCriteria_SavedSearchCriteriaVacancyPostedSince] FOREIGN KEY ([VacancyPostedSince]) REFERENCES [dbo].[SavedSearchCriteriaVacancyPostedSince] ([SavedSearchCriteriaVacancyPostedSince]),
      CONSTRAINT [uq_idx_savedSearchCriteria] UNIQUE NONCLUSTERED ([CandidateId] ASC, [Name] ASC)
  );
  
  