Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 548515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:05:13+00:00 2026-05-13T11:05:13+00:00

I’m trying to run a SQL script against SQL Server 2005 as part of

  • 0

I’m trying to run a SQL script against SQL Server 2005 as part of the set up for my integration tests. The script works perfectly fine if I execute it from within SQL Server Management Studio. However, when executing programmatically, this part of the script that enables full-text search refuses to work:

-- lots of tables and indexes created above

create unique nonclustered index [IX_Id] on [MyTable] ( [Id] asc )

-- this line fails
sp_fulltext_database enable
create fulltext catalog MyCatalog with accent_sensitivity = off as default
create fulltext index on MyTable([Title],[Content]) key index IX_Id with change_tracking auto

The error I get is:

Incorrect syntax near ‘enable’.

If I remove the lines related to full text, everything works fine. If I change the sp_fulltext_database enable call to this:

EXEC ('sp_fulltext_database enable');

I get a different error:

Cannot use full-text search in master,
tempdb, or model database.

This makes no sense to me at all. The correct database is in use.

For reference, the code that executes the script looks like this (I’m using NHibernate):

private static void InitializeDatabase()
{
    var sessionFactory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();

    using (var session = sessionFactory.OpenSession())
    {
        session.CreateSQLQuery("IF DB_ID('" + databaseName + @"') IS NOT NULL DROP DATABASE """ + databaseName + @""";").ExecuteUpdate();
        session.CreateSQLQuery(@"CREATE DATABASE """ + databaseName + @""";").ExecuteUpdate();
        session.CreateSQLQuery(@"USE """ + databaseName + @""";").ExecuteUpdate();
        session.CreateSQLQuery(GetCreationScript()).ExecuteUpdate();
    }
}

Can anyone tell me what I need to do to get this to work?

Thanks,
Kent

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:05:14+00:00Added an answer on May 13, 2026 at 11:05 am
    sp_fulltext_database 'enable'
    

    It’s a string parameter, not a reserved word.

    EDIT BY KENT: I marked as answer to give Quassnoi the rep. But to elaborate, if I add my USE database statement to the top of my script, it works. For reasons I don’t understand, it doesn’t work when I execute the USE database as a separate statement inside the same session (see my original code).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.