Things to consider when creating a searchable customer database?
<p>Our company currently has a large number of separate customer databases which have existed for years for different purposes. Online Sales, in store sales, marketing, finance etc etc. The list goes on. Probably about 10 different database. </p>

<p>I have been tasked with the creation of a new "SINGLE" database, syncing the old databases with the new one and developing a API so that we can modify the other products to hook up into the new DB.</p>

<p>One of the key features that I need is the database to be searchable in an efficient way. Since we are joining a large number of databases together there will be a lot of customers. </p>

<p>Lets assume by Customer table contains this info. </p>

<pre><code>[CustomerID]    [bigint] IDENTITY(1,1) NOT NULL,
[Title]         [nchar](20)            NULL,
[FirstName]     [nchar](50)            NOT NULL,
[MiddleName]    [nchar](50)            NULL,
[LastName]      [nchar](50)            NOT NULL,
[Alias]         [nchar](100)           NULL,
[DateOfBirth]   [date]                 NULL,
[Gender]        [char](1)              NULL
</code></pre>

<p>I was thinking i would have a SearchParameters object that would be passed to my API and build a where clause based on that. </p>

<pre><code>public class SearchParameters
{
    public long?     CustomerID  {get;set;}
    public string    Title       {get;set;}
    public string    FirstName   {get;set;}
    public string    MiddleName  {get;set;}
    public string    LastName    {get;set;}
    public string    Alias       {get;set;}
    public DateTime? DateOfBirth {get;set;}
    public char?     CustomerID  {get;set;}
}
</code></pre>

<p>And the WHERE would be:</p>

<pre><code>SELECT * FROM Customers
WHERE 
  (@CustomerID IS NULL OR CustomerID = @CustomerID)
  AND (@Title IS NULL OR Title = @Title)
  AND .... and so on
</code></pre>

<p>Is this a good approach?</p>

<p>Also what should i consider when it comes to indexing my customer table. </p>