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

  • Home
  • SEARCH
  • 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 6240509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:34:57+00:00 2026-05-24T11:34:57+00:00

I’m exploring full text index searching using SQL Server 2008 and encounter two sets

  • 0

I’m exploring full text index searching using SQL Server 2008 and encounter two sets of errors.

It stems from a a stored procedure I call with VBScript which generates would generate search hit list recordset. The stored procedure runs fine in SQL Server Management studio and basically generates a search hit list. Arguments are keyword, and style for highlighting.

Initially error:

Error One: ADODB.Recordset error ‘800a0e78 Operation is not allowed when the object is closed

at the If not recordset.EOF line in the to ASP code. Then a bit of reading and searching pointed having SET NOCOUNT ON; especially when referencing temporary tables (KB235340).

However when I specify SET NOCOUNT ON I get the error listed in “error two”. NB regarding permissions I have EXECUTE permission assigned to the account running the stored procedure to highlight the search hits.

Error Two: Microsoft OLE DB Provider for SQL Serve error ‘80040e14’
The user does not have permission to perform this action

Error Two occurs when add the SET NOCOUNT ON.

ASP Code: Line causing the error is highlighted

    Dim cmd
    Dim newParameter
    Dim recordset
    Dim SearchTerm
    Dim Style

    SearchTerm = ""
    SearchTerm = Request("searchTerm")
    Style = "background-color:yellow; font-weight:bold"

    Dim objConnectionMICenter
    Set objConnectionMICenter = Server.CreateObject("ADODB.Connection") 
    objConnectionMICenter.Open Session("ConnectMICenter") 

    Set cmd  = Server.CreateObject("ADODB.Command")
    Set cmd.ActiveConnection = objConnectionMICenter

   ' Define the stored procedure's inputs and outputs
   ' Question marks act as placeholders for each parameter for the
   ' stored procedure
   cmd.CommandType = 4 ' adCmdStoredProc
   cmd.CommandText = "HelpAndCalculationNoteHighlight"

    '--- Create and append parameter for SearchTerm 
    Set newParameter = cmd.CreateParameter("SearchTerm",203 ,1,100,SearchTerm)
    cmd.Parameters.Append newParameter

    '--- Create and append parameter for SearchTerm 
    Set newParameter = cmd.CreateParameter("Style",203 ,1,200,Style)
    cmd.Parameters.Append newParameter

    Set recordset = cmd.Execute()

     **If not recordset.EOF Then**
        While Not recordset.EOF
            response.Write "<div>" & recordset.Fields("Snippet") & "</div>"
            recordset.MoveNext
        Wend
    end if

    Response.Write strPreviewContents

    Set objConnectionMICenter = Nothing
    Set newParameter = Nothing
    Set cmd = Nothing

    recordset.Close
    Set recordset = Nothing

Stored Procedure:

ALTER PROCEDURE [dbo].[HelpAndCalculationNoteHighlight]
@SearchTerm nvarchar(100),
@Style nvarchar(200)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

CREATE TABLE #match_docs
(
doc_id bigint NOT NULL PRIMARY KEY
);

INSERT INTO #match_docs
(
doc_id
)
SELECT DISTINCT
id
FROM IntegratedHelpNotes_ChildSectionPage
WHERE FREETEXT
(
content,
@SearchTerm,
LANGUAGE N'English'
);

-- Begin Second Block
DECLARE @db_id int = DB_ID(),
@table_id int = OBJECT_ID(N'IntegratedHelpNotes_ChildSectionPage'),
@column_id int =
(
SELECT
column_id
FROM sys.columns
WHERE object_id = OBJECT_ID(N'IntegratedHelpNotes_ChildSectionPage')
AND name = N'content'
);

-- Begin Third Block
SELECT
    s.id,
    MIN
    (
        N'...' + SUBSTRING
        (
            REPLACE
                (   
                    c.content,
                    s.Display_Term,
                    N'<span style="' + @Style + '">' + s.Display_Term + '</span>'
                ),
            s.Pos - 512,
            s.Length + 1024
        ) + N'...'
    ) AS Snippet
    FROM
    (
        SELECT DISTINCT
            c.id,
            w.Display_Term,
            PATINDEX
                (
                    N'%[^a-z]' + w.Display_Term + N'[^a-z]%',
                    c.content
                ) AS Pos,
            LEN(w.Display_Term) AS Length
        FROM sys.dm_fts_index_keywords_by_document
            (
                @db_id,
                @table_id
            ) w
        INNER JOIN dbo.IntegratedHelpNotes_ChildSectionPage c
            ON w.document_id = c.id
            WHERE w.column_id = @column_id
                AND EXISTS
                    (
                        SELECT 1
                        FROM #match_docs m
                        WHERE m.doc_id = w.document_id
                    )
                AND EXISTS
                (
                    SELECT 1
                    FROM sys.dm_fts_parser
                        (
                            N'FORMSOF(FREETEXT, "' + @SearchTerm + N'")',
                            1033,
                            0,
                            1
                        ) p
                    WHERE p.Display_Term = w.Display_Term
                    )
                ) s
            INNER JOIN dbo.IntegratedHelpNotes_ChildSectionPage c
            ON s.id = c.id
            GROUP BY
            s.id;
DROP TABLE #match_docs;
END;
  • 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-24T11:34:57+00:00Added an answer on May 24, 2026 at 11:34 am

    The sys.dm views you use require elevated permissions

    • sys.dm_fts_parser = sysadmin
    • sys.dm_fts_index_keywords_by_document = CREATE FULLTEXT CATALOG

    As you mentioned, you are using 2 different sets of credentials.

    You are sysadmin in SSMS and plain user from vb script.

    You can try “EXECUTE AS OWNER” in the stored procedure. Or try wrapping sys.dm_fts_parser in a view in master (also with EXECUTE AS OWNER)

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a bunch of posts stored in text files formatted in yaml/textile (from
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm making a simple page using Google Maps API 3. My first. One marker
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

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.