title: Conditionally create a fulltext catalog in one line of SQL (from an installer)
body: <p>I'm building an installer using WiX (not keyworded since WiX is not the problem here) that shall create a fulltext index for a SQL Server Express 2005 Advanced Services database.</p>
  
  <p>Up to now I use the SQL</p>
  
  <pre><code> CREATE FULLTEXT CATALOG Foobar in path 'c:\Whereever'
  </code></pre>
  
  <p>Now, the installer will not remove the database on uninstall as it may contain valuable user data. Now when I update the software it will stumble over the creation of the already existing fulltext index. (Abort in installer, as it can't run that line of SQL)</p>
  
  <p>What I want to do is run the line conditionally if the fulltext index does not already exist. I'd expect something like</p>
  
  <pre><code>IF NOT EXISTS(SELECT * from sys.??????? WHERE name = 'Foobar')
      CREATE FULLTEXT CATALOG Foobar in path 'c:\Whereever'
  </code></pre>
  
  <p>(I just saw something similar to what I need <a href="https://stackoverflow.com/questions/778518/conditionally-create-user-in-sql-server">here on stackoverflow</a>)</p>
  
  <p>But where (and how) can I find out whether the index is recorded in a sys table (and which table is it?)</p>